qat.experimental.dialect.pulse.ir.attributes module
- class AmplitudeAttr(value)
Bases:
PulseNumericTypedAttr[AmplitudeType]An attribute that represents a compile-time constant amplitude.
- Variables:
real – The real part of the amplitude, which is expected to be a float representing the amplitude in arbitrary units.
imag – The imaginary part of the amplitude, which is expected to be a float representing the amplitude in arbitrary units, and defaults to 0.0 if not provided.
- Parameters:
value¶ (
complex|float) – The amplitude value, which can be a complex number or a float. If a float is provided, the imaginary part is set to 0.0.
- property associated_type: type[AmplitudeType]
Returns the associated dialect type.
- classmethod get_irdl_definition()
Get the IRDL attribute definition.
-
imag:
FloatData
- property literal_value: complex
Returns the amplitude value as a complex number.
- name: ClassVar[str] = 'pulse.amplitude_attr'
The attribute name should be a static field in the attribute classes.
-
real:
FloatData
- class FrequencyAttr(value, unit=FrequencyUnits.HERTZ)
Bases:
PulseNumericTypedAttr[FrequencyType]An attribute that represents a compile-time constant frequency.
- Variables:
value – The frequency value, which can be a float or an integer.
unit – The frequency units, which is an instance of the
FrequencyUnitsenum.
- Parameters:
value¶ (
float|int) – The frequency value in Hz, which can be a float or an integer.unit¶ (
FrequencyUnits) – The frequency units, which is an instance of theFrequencyUnits, enum and defaults to hertz if not provided.
- property associated_type: type[FrequencyType]
Returns the associated dialect type.
- classmethod get_irdl_definition()
Get the IRDL attribute definition.
- property literal_value: float | int
Returns the frequency value in Hertz.
- name: ClassVar[str] = 'pulse.frequency_attr'
The attribute name should be a static field in the attribute classes.
-
unit:
FrequencyUnitsData
-
value:
FloatData|IntAttr
- class FrequencyUnitsData(data)
Bases:
Data[FrequencyUnits]Data attribute for representing frequency units in the pulse dialect.
- data: DataElement
- name: ClassVar[str] = 'pulse.frequency_units'
The attribute name should be a static field in the attribute classes.
- classmethod parse_parameter(parser)
Parses the parameters of the attribute, which are expected to be a string representing the frequency units.
- Return type:
- print_parameter(printer)
Prints the parameters of the attribute, which are expected to be a string representing the frequency units.
- Return type:
None
- class PhaseAttr(value)
Bases:
PulseNumericTypedAttr[PhaseType]An attribute that represents a compile-time constant phase. Phases are represented by radians.
- Variables:
value – The phase value, which is expected to be a float representing the phase in radians.
- Parameters:
value¶ (
float) – The phase value in radians, represented as a float.
- classmethod get_irdl_definition()
Get the IRDL attribute definition.
- property literal_value: float
Returns the phase value.
- name: ClassVar[str] = 'pulse.phase_attr'
The attribute name should be a static field in the attribute classes.
-
value:
FloatData
- class PulseNumericTypedAttr(*parameters)
Bases:
ParametrizedAttribute,Generic[PULSE_VAR_TYPE],ABCBase class for attributes in the pulse dialect that have a type associated with them.
This is used to group together attributes that represent typed values, such as frequencies, phases, times and amplitudes.
- abstract property associated_type: type[PULSE_VAR_TYPE]
Returns the type that is associated with this attribute, which is specified by the concrete subclass.
- abstract property literal_value: Number
Converts the attribute to a literal value, which is returned as a numeric value, and specified by the concrete subclass.
- class SampledWaveformAttr(samples, width, sample_time)
Bases:
PulseNumericTypedAttr[WaveformType]An attribute that represents a sampled waveform, which is represented by a real or complex numpy array.
- Parameters:
samples¶ (
ndarray[complex] |list[complex]) – The samples of the waveform, represented as a numpy array or a list of floats or complex numbers.width¶ (
TimeAttr) – The total width of the waveform, represented as a TimeAttr.sample_time¶ (
TimeAttr) – The time between samples, represented as a TimeAttr.
- property associated_type: type[WaveformType]
Returns the associated dialect type.
- classmethod get_irdl_definition()
Get the IRDL attribute definition.
- property literal_value: ndarray
Returns the samples of the waveform as a numpy array.
- name: ClassVar[str] = 'pulse.sampled_waveform'
The attribute name should be a static field in the attribute classes.
-
samples:
WaveformData
- class TimeAttr(value, unit=TimeUnits.SECOND)
Bases:
PulseNumericTypedAttr[TimeType]An attribute that represents a compile-time constant time.
This attribute intentionally does not specify the precision of the time value, and uses the standard Python precision for its respective type. The representation of the value will be set by the target.
- Variables:
value – The time value, which can be a float or an integer.
unit – The time units, which is an instance of the
TimeUnitsenum.
- Parameters:
- classmethod get_irdl_definition()
Get the IRDL attribute definition.
- property literal_value: float | int
Returns the time value in seconds.
- name: ClassVar[str] = 'pulse.time_attr'
The attribute name should be a static field in the attribute classes.
-
unit:
TimeUnitsData
-
value:
FloatData|IntAttr
- class TimeUnitsData(data)
Bases:
Data[TimeUnits]Data attribute for representing time units in the pulse dialect.
- data: DataElement
- name: ClassVar[str] = 'pulse.time_units'
The attribute name should be a static field in the attribute classes.
- classmethod parse_parameter(parser)
Parses the parameters of the attribute, which are expected to be a string representing the time units.
- Return type:
- print_parameter(printer)
Prints the parameters of the attribute, which are expected to be a string representing the time units.
- Return type:
None
- class WaveformData(data)
Bases:
Data[ndarray[complexfloating]]Stores waveforms for use in attributes.
Manipulations of sampled waveforms are processed using numpy due to its performance, and for this reason, we store this data as a numpy array.
To be future thinking, and compatible with integrations with MLIR in the future, we print and parse the data as a list of builtin attributes, with the conversion handled in the interface.
- data: DataElement
- name: ClassVar[str] = 'pulse.waveform_data'
The attribute name should be a static field in the attribute classes.
- classmethod parse_parameter(parser)
Parses the parameters of the attribute, which are expected to be a list of builtin complex attributes representing the samples of the waveform.
- Return type:
ndarray[complex128]
- print_parameter(printer)
Prints the parameters as textual MLIR, which are provided as complex attributes in a list.
- Return type:
None