nenupy.io.tf_utils.compute_spectra_time

nenupy.io.tf_utils.compute_spectra_time(block_start_time_unix, ntime_per_block, time_step_s)[source]

Compute the time axis of a time-frequency file. Re-construct the whole time range, knowing the starting unix time of each time block, the number of time samples per block and the time resolution.

Parameters:
  • block_start_time_unix (ndarray) – Array of start times of each block, in UNIX format

  • ntime_per_block (int) – Number of time samples per block

  • time_step_s (float) – Time resolution in seconds

Returns:

The time array (Dask format), in unix

Return type:

Array

Example

>>> from nenupy.io.tf_utils import compute_spectra_time
>>> from astropy.time import Time
>>> import astropy.units as u

>>> nffte = 42
>>> dt = 0.02097152 * u.s
>>> start_times = Time([
        '2024-07-15T08:31:12.000', '2024-07-15T08:31:12.881',
        '2024-07-15T08:31:13.762', '2024-07-15T08:31:14.642',
        '2024-07-15T08:31:15.523', '2024-07-15T08:31:16.404',
        '2024-07-15T08:31:17.285', '2024-07-15T08:31:18.166',
        '2024-07-15T08:31:19.046', '2024-07-15T08:31:19.927'
    ])
>>> time_axis = compute_spectra_time(
        block_start_time_unix=start_times.unix,
        ntime_per_block=nffte,
        time_step_s=dt.to_value(u.s)
    )
>>> time_axis.compute()
array([1721032272.0, 1721032272.0209715, ...])