Teradata Package for Python Function Reference on VantageCloud Lake - LineSpec - Teradata Package for Python - Look here for syntax, methods and examples for the functions included in the Teradata Package for Python.

Teradata® Package for Python Function Reference on VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Package for Python
Release Number
20.00.00.03
Published
December 2024
ft:locale
en-US
ft:lastEdition
2024-12-19
dita:id
TeradataPython_FxRef_Lake_2000
Product Category
Teradata Vantage
 
 
LineSpec

 
Functions
       
LineSpec(data=None, data_filter_expr=None, freq_style='K_INTEGRAL', include_coeff=False, zero_padding_ok=True, hertz_sample_rate=None, **generic_arguments)
DESCRIPTION:
    The LineSpec() function identifies periodicity that may be inherent in
    an input series.
    The following procedure is an example of how to use LineSpec:
        1. Use ArimaEstimate() to identify spectral candidates.
        2. Use ArimaValidate() to validate spectral candidates.
        3. Use LineSpec() with "freq_style" parameter set to K_PERIODICITY
           to perform spectral analysis.
        4. Use DataFrame.plot() to plot the results.
        5. Compute the test statistic.
        6. Use SignifPeriodicities() on the periodicities of interest.
           More than one periodicity can be entered using the "periodicities"
           parameter.
 
PARAMETERS:
    data:
        Required Argument.
        Specifies an input time series whose payload content has one of the
        following values:
            * REAL
            * COMPLEX
            * MULTIVAR_REAL
            * MULTIVAR_COMPLEX
        Types: TDSeries
 
    data_filter_expr:
        Optional Argument.
        Specifies the filter expression for "data".
        Types: ColumnExpression
 
    freq_style:
        Optional Argument.
        Specifies the format or values associated with the x-axis of the
        output.
        Permitted Values:
            * K_INTEGRAL: Integer representation.
            * K_SAMPLE_RATE: Integer normalized to number entries, with
                              ranges from -0.5 to +0.5.
            * K_RADIANS: Radian ranges from -π to +π.
            * K_PERIODICITY: Periodicity.
        Default Value: K_INTEGRAL
        Types: str
 
    include_coeff:
        Optional Argument.
        Specifies whether to include the calculated αk and βk values
        in the output. The formula for the magnitude at time k in the
        line spectrum is:
            (n/2) * ((αk)**2 + (βk)**2)
        Default Value: False
        Types: bool
 
    zero_padding_ok:
        Optional Argument.
        Specifies whether to add zeros to the end of time series
        to make computation more efficient. When set to False, does
        not add zeros, otherwise zeros are added.
        Default Value: True
        Types: bool
 
    hertz_sample_rate:
        Optional Argument.
        Specifies the sample rate as a floating point constant, in hertz.
        A value of 10000.0 indicates that the sample points were obtained
        by sampling at a rate of 10,000 hertz. This hertz interpretation
        applies to both the ROW_I and COLUMN_I indices.
        Types: float
 
    **generic_arguments:
        Specifies the generic keyword arguments of UAF functions. 
        Below are the generic keyword arguments:
            persist:
                Optional Argument.
                Specifies whether to persist the results of the
                function in a table or not. When set to True,
                results are persisted in a table; otherwise,
                results are garbage collected at the end of the
                session.
                Note that, when UAF function is executed, an 
                analytic result table (ART) is created.
                Default Value: False
                Types: bool
 
            volatile:
                Optional Argument.
                Specifies whether to put the results of the
                function in a volatile ART or not. When set to
                True, results are stored in a volatile ART,
                otherwise not.
                Default Value: False
                Types: bool
 
            output_table_name:
                Optional Argument.
                Specifies the name of the table to store results. 
                If not specified, a unique table name is internally 
                generated.
                Types: str
 
            output_db_name:
                Optional Argument.
                Specifies the name of the database to create output 
                table into. If not specified, table is created into 
                database specified by the user at the time of context 
                creation or configuration parameter. Argument is ignored,
                if "output_table_name" is not specified.
                Types: str
 
 
RETURNS:
    Instance of LineSpec.
    Output teradataml DataFrames can be accessed using attribute 
    references, such as LineSpec_obj.<attribute_name>.
    Output teradataml DataFrame attribute name is:
        1. result
 
 
RAISES:
    TeradataMlException, TypeError, ValueError
 
 
EXAMPLES:
    # Notes:
    #     1. Get the connection to Vantage to execute the function.
    #     2. One must import the required functions mentioned in
    #        the example from teradataml.
    #     3. Function will raise error if not supported on the Vantage
    #        user is connected to.
 
    # Check the list of available UAF analytic functions.
    display_analytic_functions(type="UAF")
 
    # Load the example data.
    load_example_data("uaf", ["TestRiver"])
 
    # Create teradataml DataFrame object.
    df = DataFrame.from_table("TestRiver")
 
    # Create teradataml TDSeries object.
    result = TDSeries(data=df, id="BuoyID", row_index="N_SeqNo",
                      row_index_style="SEQUENCE", payload_field="MAGNITUDE",
                      payload_content="REAL")
 
    # Example 1 : Execute function to identify the periodicity of the input
    #             series.
    uaf_out = LineSpec(data=result)
 
    # Print the result DataFrame.
    print(uaf_out.result)