nidaqmx.scale
- class nidaqmx.scale.Scale(name)[source]
Bases:
object
Represents a DAQmx scale.
- static calculate_reverse_poly_coeff(forward_coeffs, min_val_x=- 5.0, max_val_x=5.0, num_points_to_compute=1000, reverse_poly_order=- 1)[source]
Computes a set of coefficients for a polynomial that approximates the inverse of the polynomial with the coefficients you specify with the “forward_coeffs” input. This function generates a table of x versus y values over the range of x. This function then finds a polynomial fit, using the least squares method to compute a polynomial that computes x when given a value for y.
- Parameters
forward_coeffs (List[float]) – Is the list of coefficients for the polynomial that computes y given a value of x. Each element of the list corresponds to a term of the equation.
min_val_x (Optional[float]) – Is the minimum value of x for which you use the polynomial. This is the smallest value of x for which the function generates a y value in the table.
max_val_x (Optional[float]) – Is the maximum value of x for which you use the polynomial. This is the largest value of x for which the function generates a y value in the table.
num_points_to_compute (Optional[int]) – Is the number of points in the table of x versus y values. The function spaces the values evenly between “min_val_x” and “max_val_x”.
reverse_poly_order (Optional[int]) – Is the order of the reverse polynomial to compute. For example, an input of 3 indicates a 3rd order polynomial. A value of -1 indicates a reverse polynomial of the same order as the forward polynomial.
- Returns
Specifies the list of coefficients for the reverse polynomial. Each element of the list corresponds to a term of the equation. For example, if index three of the list is 9, the fourth term of the equation is 9y^3.
- Return type
List[float]
- static create_lin_scale(scale_name, slope, y_intercept=0.0, pre_scaled_units=UnitsPreScaled.VOLTS, scaled_units=None)[source]
Creates a custom scale that uses the equation y=mx+b, where x is a pre-scaled value, and y is a scaled value. The equation is identical for input and output. If the equation is in the form x=my+b, you must first solve for y in terms of x.
- Parameters
scale_name (str) – Specifies the name of the scale to create.
slope (float) – Is the slope, m, in the equation.
y_intercept (Optional[float]) – Is the y-intercept, b, in the equation.
pre_scaled_units (Optional[nidaqmx.constants.UnitsPreScaled]) – Is the units of the values to scale.
scaled_units (Optional[str]) – Is the units to use for the scaled value. You can use an arbitrary string. NI-DAQmx uses the units to label a graph or chart.
- Returns
Indicates an object that represents the created custom scale.
- Return type
- static create_map_scale(scale_name, prescaled_min, prescaled_max, scaled_min, scaled_max, pre_scaled_units=UnitsPreScaled.VOLTS, scaled_units=None)[source]
Creates a custom scale that scales values proportionally from a range of pre-scaled values to a range of scaled values.
- Parameters
scale_name (str) – Specifies the name of the scale to create.
prescaled_min (float) – Is the smallest value in the range of pre-scaled values. NI-DAQmx maps this value to “scaled_min”.
prescaled_max (float) – Is the largest value in the range of pre-scaled values. NI-DAQmx maps this value to “scaled_max”.
scaled_min (float) – Is the smallest value in the range of scaled values. NI-DAQmx maps this value to “prescaled_min”. Read operations clip samples that are smaller than this value. Write operations generate errors for samples that are smaller than this value.
scaled_max (float) – Is the largest value in the range of scaled values. NI-DAQmx maps this value to “prescaled_max”. Read operations clip samples that are larger than this value. Write operations generate errors for samples that are larger than this value.
pre_scaled_units (Optional[nidaqmx.constants.UnitsPreScaled]) – Is the units of the values to scale.
scaled_units (Optional[str]) – Is the units to use for the scaled value. You can use an arbitrary string. NI-DAQmx uses the units to label a graph or chart.
- Returns
Indicates an object that represents the created custom scale.
- Return type
- static create_polynomial_scale(scale_name, forward_coeffs, reverse_coeffs, pre_scaled_units=UnitsPreScaled.VOLTS, scaled_units=None)[source]
Creates a custom scale that uses an nth order polynomial equation. NI-DAQmx requires both a polynomial to convert pre- scaled values to scaled values (forward) and a polynomial to convert scaled values to pre-scaled values (reverse). If you only know one set of coefficients, use the DAQmx Compute Reverse Polynomial Coefficients function to generate the other set.
- Parameters
scale_name (str) – Specifies the name of the scale to create.
forward_coeffs (List[float]) – Is an list of coefficients for the polynomial that converts pre-scaled values to scaled values. Each element of the list corresponds to a term of the equation.
reverse_coeffs (List[float]) – Is an list of coefficients for the polynomial that converts scaled values to pre-scaled values. Each element of the list corresponds to a term of the equation.
pre_scaled_units (Optional[nidaqmx.constants.UnitsPreScaled]) – Is the units of the values to scale.
scaled_units (Optional[str]) – Is the units to use for the scaled value. You can use an arbitrary string. NI-DAQmx uses the units to label a graph or chart.
- Returns
Indicates an object that represents the created custom scale.
- Return type
- static create_table_scale(scale_name, prescaled_vals, scaled_vals, pre_scaled_units=UnitsPreScaled.VOLTS, scaled_units=None)[source]
Creates a custom scale that maps an list of pre-scaled values to an list of corresponding scaled values. NI-DAQmx applies linear interpolation to values that fall between the values in the table. Read operations clip scaled samples that are outside the maximum and minimum scaled values found in the table. Write operations generate errors for samples that are outside the minimum and maximum scaled values found in the table.
- Parameters
scale_name (str) – Specifies the name of the scale to create.
prescaled_vals (List[float]) – Is the list of pre-scaled values that map to the values in “scaled_vals”.
scaled_vals (List[float]) – Is the list of scaled values that map to the values in “prescaled_vals”.
pre_scaled_units (Optional[nidaqmx.constants.UnitsPreScaled]) – Is the units of the values to scale.
scaled_units (Optional[str]) – Is the units to use for the scaled value. You can use an arbitrary string. NI-DAQmx uses the units to label a graph or chart.
- Returns
Indicates an object that represents the created custom scale.
- Return type
- property description
Specifies a description for the scale.
- Type
str
- property lin_slope
Specifies the slope, m, in the equation y=mx+b.
- Type
float
- property lin_y_intercept
Specifies the y-intercept, b, in the equation y=mx+b.
- Type
float
- property map_pre_scaled_max
Specifies the largest value in the range of pre-scaled values. NI-DAQmx maps this value to map_scaled_max.
- Type
float
- property map_pre_scaled_min
Specifies the smallest value in the range of pre-scaled values. NI-DAQmx maps this value to map_scaled_min.
- Type
float
- property map_scaled_max
Specifies the largest value in the range of scaled values. NI-DAQmx maps this value to map_pre_scaled_max. Reads coerce samples that are larger than this value to match this value. Writes generate errors for samples that are larger than this value.
- Type
float
- property map_scaled_min
Specifies the smallest value in the range of scaled values. NI-DAQmx maps this value to map_pre_scaled_min. Reads coerce samples that are smaller than this value to match this value. Writes generate errors for samples that are smaller than this value.
- Type
float
- property name
Specifies the name of this scale.
- Type
str
- property poly_forward_coeff
Specifies a list of coefficients for the polynomial that converts pre-scaled values to scaled values. Each element of the list corresponds to a term of the equation. For example, if index three of the list is 9, the fourth term of the equation is 9x^3.
- Type
List[float]
- property poly_reverse_coeff
Specifies a list of coefficients for the polynomial that converts scaled values to pre-scaled values. Each element of the list corresponds to a term of the equation. For example, if index three of the list is 9, the fourth term of the equation is 9y^3.
- Type
List[float]
- property pre_scaled_units
Specifies the units of the values that you want to scale.
- save(save_as='', author='', overwrite_existing_scale=False, allow_interactive_editing=True, allow_interactive_deletion=True)[source]
Saves this custom scale to MAX.
- Parameters
save_as (Optional[str]) – Is the name to save the task, global channel, or custom scale as. If you do not specify a value for this input, NI-DAQmx uses the name currently assigned to the task, global channel, or custom scale.
author (Optional[str]) – Is a name to store with the task, global channel, or custom scale.
options (Optional[int]) – Specifies whether to allow the task, global channel, or custom scale to be deleted through MAX.
overwrite_existing_scale (Optional[bool]) – Specifies whether to overwrite a custom scale of the same name if one is already saved in MAX. If this input is False and a custom scale of the same name is already saved in MAX, this function returns an error.
allow_interactive_editing (Optional[bool]) – Specifies whether to allow the task, global channel, or custom scale to be edited in the DAQ Assistant. If allow_interactive_editing is True, the DAQ Assistant must support all task or global channel settings.
allow_interactive_deletion (Optional[bool]) – Specifies whether to allow the task, global channel, or custom scale to be deleted through MAX.
- property scale_type
Indicates the method or equation form that the custom scale uses.
- property scaled_units
Specifies the units to use for scaled values. You can use an arbitrary string.
- Type
str
- property table_pre_scaled_vals
Specifies a list of pre-scaled values. These values map directly to the values in table_scaled_vals.
- Type
List[float]
- property table_scaled_vals
Specifies a list of scaled values. These values map directly to the values in table_pre_scaled_vals.
- Type
List[float]