| |
- DFFTConv(data=None, data_filter_expr=None, conv=None, freq_style='K_INTEGRAL', hertz_sample_rate=None, output_fmt_content=None, **generic_arguments)
- DESCRIPTION:
The DFFTConv() function is a Fast Fourier Transform converter
that converts output generated by DFFT(). DFFT() results are
in human-readable and raw form. DFFTConv() can also output different
payload types such as AMPL_PHASE_DEGREES, MULTIVAR_AMPL_PHASE_RADIANS,
COMPLEX. However, user may want a different result form in order
to pass the results to another UAF function, plot the results in human
readable form, compare the results to Python, and so on. Instead of
rerunning DFFT() to produce a different result set, user can use DFFTConv()
to accomplish the task faster and with less memory consumption.
PARAMETERS:
data:
Required Argument.
Specifies the input series or a TDAnalyticResult object created over the
output generated by the UAF function.
Types: TDSeries, TDAnalyticResult
data_filter_expr:
Optional Argument.
Specifies the filter expression for "data".
Types: ColumnExpression
conv:
Required Argument.
Specifies the type of conversion to be performed by the
function.
Permitted Values:
* HR_TO_RAW: Convert from human readable to raw form.
* RAW_TO_HR: Convert from raw form to human readable form.
Types: str
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, ranging from -0.5 to +0.5.
* K_RADIANS: Radian ranges from -π to +π.
* K_HERTZ: Frequency in hertz. Must be used in conjunction with "hertz_sample_rate".
Default Value: K_INTEGRAL
Types: str
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.
Value should be greater than 0.
Notes:
* Applicable only when "freq_style" is set to 'K_HERTZ'.
Types: float
output_fmt_content:
Optional Argument.
Specifies a complex number that can be in rectangular (real, imaginary)
or polar (amplitude, phase) form. The default is rectangular (real,
imaginary). The output options are as follows:
* COMPLEX
* AMPL_PHASE_DEGREES
* AMPL_PHASE_RADIANS
* AMPL_PHASE
The MULTIVAR options are below. The default is MULTIVAR_COMPLEX:
* MULTIVAR_COMPLEX
* MULTIVAR_AMPL_PHASE_DEGREES
* MULTIVAR_AMPL_PHASE_RADIANS
* MULTIVAR_AMPL_PHASE
Valid Conversion:
COMPLEX -> COMPLEX
COMPLEX -> AMPL_PHASE
AMPL_PHASE -> AMPL_PHASE
AMPL_PHASE -> COMPLEX
MULTIVAR_COMPLEX -> MULTIVAR_COMPLEX
MULTIVAR_COMPLEX -> MULTVAR_AMPL_PHASE
MULTIVAR_AMPL_PHASE -> MULTIVAR_AMPL_PHASE
MULTIVAR_AMPL_PHASE -> MULTIVAR_COMPLEX
Rest of conversions are invalid.
Permitted Values: COMPLEX,
AMPL_PHASE_RADIANS,
AMPL_PHASE_DEGREES,
AMPL_PHASE,
MULTIVAR_COMPLEX,
MULTIVAR_AMPL_PHASE_RADIANS,
MULTIVAR_AMPL_PHASE_DEGREES,
MULTIVAR_AMPL_PHASE
Types: str
**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 DFFTConv.
Output teradataml DataFrames can be accessed using attribute
references, such as DFFTConv_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", ["DFFTConv_Real_8_8"])
# Create teradataml DataFrame object.
df = DataFrame("DFFTConv_Real_8_8")
# Create teradataml TDSeries object.
td_series = TDSeries(data=df,
id="ID",
row_index="ROW_I",
row_index_style="SEQUENCE",
payload_field="MAGNITUDE",
payload_content="REAL")
# Compute the complex Fourier Transform Coefficients
# using a sequential series.
dfft = DFFT(data=td_series,
freq_style="K_INTEGRAL",
human_readable=False,
output_fmt_content="COMPLEX")
# Create teradataml TDAnalyticResult object.
art_spec = TDAnalyticResult(data=dfft.result)
# Example 1 : Convert the complex(REAL,IMAGINARY) output of DFFT() to
# polar(AMPLITUDE,PHASE) in RADIAN format.
dfft_conv = DFFTConv(data=art_spec,
conv="RAW_TO_HR",
output_fmt_content="AMPL_PHASE_RADIANS")
# Print the result DataFrame.
print(dfft_conv.result)
|