FrequencyAxis

Class representing frequency axis of calculations

Examples

The default type of the FrequencyAxis is complete. See the discussion of the types in the TimeAxis documentation.

>>> wa = FrequencyAxis(0.0,100,0.05)
>>> ta = wa.get_TimeAxis()
>>> print(ta.length)
100

The type upper-half only refers to the corresponding TimeAxis. Everything about the FrequencyAxis remains the same as with complete.

>>> wa = FrequencyAxis(0.0, 100, 0.05, atype = "upper-half")
>>> ta = wa.get_TimeAxis()
>>> print(ta.length)
50

#>>> print(ta.step,2.0*numpy.pi/(100*wa.step))

>>> print(numpy.allclose(ta.step,2.0*numpy.pi/(100*wa.step)))
True

For complete, everything should work also for an odd number of points

>>> wa = FrequencyAxis(0.0,99,0.05)
>>> ta = wa.get_TimeAxis()
>>> print(ta.length)
99

But upper-half throws an exception, because by definition its number of points is 2*N, where N is an integer.

>>> wa = FrequencyAxis(0.0,99,0.05,atype="upper-half")
>>> ta = wa.get_TimeAxis()
Traceback (most recent call last):
...
Exception: Cannot create upper-half TimeAxis from an odd number of points

Relation between TimeAxis and FrequencyAxis

Complete FrequencyAxis and even number of points

>>> wa = FrequencyAxis(0.0,10,0.1,atype="complete")
>>> frequencies = [0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9]
>>> print(numpy.allclose(wa.data,frequencies))
True
>>> ta = wa.get_TimeAxis()
>>> times = 2.0*numpy.pi*numpy.fft.fftshift(numpy.fft.fftfreq(10,0.1))
>>> print(numpy.allclose(ta.data,times))
True
>>> print(numpy.allclose(ta.step,times[1]-times[0]))
True
>>> wb = ta.get_FrequencyAxis()
>>> print(numpy.allclose(wb.data,frequencies))
True
>>> tb = wb.get_TimeAxis()
>>> print(numpy.allclose(tb.data,times))
True

Complete FrequencyAxis and odd number of points

>>> wa = FrequencyAxis(0.0,11,0.1,atype="complete")
>>> frequencies = [0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0]
>>> print(numpy.allclose(wa.data,frequencies))
True
>>> ta = wa.get_TimeAxis()
>>> times = 2.0*numpy.pi*numpy.fft.fftshift(numpy.fft.fftfreq(11,0.1))
>>> print(numpy.allclose(ta.data,times))
True
>>> print(numpy.allclose(ta.step,times[1]-times[0]))
True
>>> wb = ta.get_FrequencyAxis()
>>> print(numpy.allclose(wb.data,frequencies))
True
>>> tb = wb.get_TimeAxis()
>>> print(numpy.allclose(tb.data,times))
True

Upper-half FrequencyAxis and even number of points

>>> wa = FrequencyAxis(0.0,10,0.1,atype="upper-half")
>>> frequencies = [0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9]
>>> print(numpy.allclose(wa.data,frequencies))
True
>>> ta = wa.get_TimeAxis()
>>> times = 2.0*numpy.pi*numpy.fft.fftshift(numpy.fft.fftfreq(10,0.1))
>>> print(numpy.allclose(ta.data,times[5:10]))
True
>>> print(numpy.allclose(ta.step,times[1]-times[0]))
True
>>> wb = ta.get_FrequencyAxis()
>>> print(numpy.allclose(wb.data,frequencies))
True
>>> tb = wb.get_TimeAxis()
>>> print(numpy.allclose(tb.data,times[5:10]))
True

Class Details

class quantarhei.core.frequency.FrequencyAxis(start=0.0, length=1, step=1.0, atype='complete', time_start=0.0)[source]

Class representing frequency axis of calculations

Parameters:
  • start (float) – start of the FrequencyAxis
  • length (int) – number of steps
  • step (float) – time step
  • atype (string {"complete","upper-half"}) – Axis type
Attributes:
data
length
max

Returns the maximum value on the axis

min

Returns the minimum value on the axis

start
step

Methods

copy() Returns a shallow copy of the self
deepcopy() Returns a deep copy of the self
get_TimeAxis() Returns the corresponding TimeAxis object
is_equal_to(axis) Returns True if the axis is equal to this ValueAxis
is_extension_of(axis) Returns True if the axis is contained in this ValueAxis
is_subsection_of(axis) Returns True if the axis contains this ValueAxis
is_subset_of(axis) Returns True if the ValueAxis is a subset of axis
is_superset_of(axis) Returns True if the ValueAxis is a superset of axis
load(filename[, test]) Loads an object from a file and returns it
loaddir(dirname) Returns a directory of objects saved into a directory
locate(val) Returns the index of the lower neigbor of the val
nearest(val) Returns the index of the nearest neighbor to val
save(filename[, comment, test]) Saves the object with all its content into a file
savedir(dirname[, tag, comment, test]) Saves an object into directory containing a file with unique name
scopy() Creates a copy of the object by saving and loading it
convert_2_current_u  
convert_2_internal_u  
unit_repr  
unit_repr_latex  
copy()[source]

Returns a shallow copy of the self

get_TimeAxis()[source]

Returns the corresponding TimeAxis object

quantarhei.core.frequency.UnitsManagedReal(name, *, dtype=<class 'numbers.Real'>)

Scalar property with units managed

Warning: The type of the property depends on the object; The object has to be EnergyUnitsManaged or similar.

quantarhei.core.frequency.UnitsManagedRealArray(name, *, dtype=<class 'numbers.Real'>, shape=None)

Array property with units managed

Warning: The type of the property depends on the object; The object has to be EnergyUnitsManaged or similar.