Disperse¶
- class baseband.tasks.Disperse(ih, dm, *, reference_frequency=None, samples_per_frame=None, frequency=None, sideband=None)[source] [edit on github]¶
Bases:
PaddedTaskBaseCoherently disperse a time stream.
- Parameters:
- ihtask or
basebandstream reader Input data stream, with time as the first axis.
- dmfloat or
DispersionMeasurequantity Dispersion measure. If negative, will dedisperse correctly, but clearer to use the
Dedisperseclass.- reference_frequency
Quantity, optional Frequency to which the data should be dispersed. Can be an array. By default, the mean frequency.
- samples_per_frameint, optional
Number of dispersed samples which should be produced in one go. The number of input samples used will be larger to avoid wrapping. If not given, the minimum length that gives at least 75% efficiency and ensures efficient fast fourier transforms.
- frequency
Quantity, optional Frequencies for each channel in
ih(channelized frequencies will be calculated). Default: taken fromih(if available).- sidebandarray, optional
Whether frequencies in
ihare upper (+1) or lower (-1) sideband. Default: taken fromih(if available).
- ihtask or
See also
baseband_tasks.fourier.fft_makerto select the FFT package used.
baseband_tasks.dispersion.Dedispersefor coherent dedispersion
baseband_tasks.dispersion.DisperseSamplesfor incoherent dispersion
Attributes Summary
Data type of the output.
Number of dimensions of the output.
Phase offsets of the Fourier-transformed frame.
Number of complete samples per second.
Shape of a complete sample.
Number of samples per frame of data.
Shape of the output.
Number of component samples in the output.
Start time of the output.
Time at the end of the output, just after the last sample.
Time of the sample pointer's current offset in the output.
Methods Summary
close()Close task.
read([count, out])Read a number of complete samples.
seek(offset[, whence])Change the sample pointer position.
task(data)tell([unit])Current offset in the file.
Attributes Documentation
- closed = False¶
- complex_data¶
- dm¶
- dtype¶
Data type of the output.
- meta = None¶
- ndim¶
Number of dimensions of the output.
- offset = 0¶
- phase_factor¶
Phase offsets of the Fourier-transformed frame.
- sample_rate¶
Number of complete samples per second.
- sample_shape¶
Shape of a complete sample.
- samples_per_frame¶
Number of samples per frame of data.
For compatibility with file readers, to help indicate what a nominal chunk of data is.
- shape¶
Shape of the output.
- size¶
Number of component samples in the output.
- stop_time¶
Time at the end of the output, just after the last sample.
See also
start_timeandtime.
- time¶
Time of the sample pointer’s current offset in the output.
See also
start_timeandstop_time.
Methods Documentation
- close()[source] [edit on github]¶
Close task.
Note that this does not explicitly close the underlying source; instead, it just deletes the reference to it.
- read(count=None, out=None) [edit on github]¶
Read a number of complete samples.
- Parameters:
- countint or None, optional
Number of complete samples to read. If
None(default) or negative, the number of samples left. Ignored ifoutis given.- outNone or array, optional
Array to store the samples in. If given,
countwill be inferred from the first dimension; the remaining dimensions should equalsample_shape.
- Returns:
- out
ndarrayof float or complex The first dimension is sample-time, and the remaining ones are as given by
sample_shape.
- out
- seek(offset, whence=0) [edit on github]¶
Change the sample pointer position.
This works like a normal filehandle seek, but the offset is in samples (or a relative or absolute time).
- Parameters:
- offsetint,
Quantity, orTime Offset to move to. Can be an (integer) number of samples, an offset in time units, or an absolute time. For the latter two, the pointer will be moved to the nearest integer sample.
- whence{0, 1, 2, ‘start’, ‘current’, or ‘end’}, optional
Like regular seek, the offset is taken to be from the start if
whence=0(default), from the current position if 1, and from the end if 2. One can alternativey use ‘start’, ‘current’, or ‘end’ for 0, 1, or 2, respectively. Ignored ifoffsetis a time.
- offsetint,
- task(data)[source] [edit on github]¶
- tell(unit=None) [edit on github]¶
Current offset in the file.
- Parameters:
- unit
Unitor str, optional Time unit the offset should be returned in. By default, no unit is used, i.e., an integer enumerating samples is returned. For the special string ‘time’, the absolute time is calculated.
- unit
- Returns: