sigpyproc.utils

sigpyproc.utils

class sigpyproc.utils.AttrDict(*args, **kwargs)

Bases: dict

sigpyproc.utils.roll_array(arr, shift, axis)

Roll the elements in the array by shift positions along the given axis.

Parameters
  • arr (ArrayLike) – input array to roll

  • shift (int) – number of bins to shift by

  • axis (int) – axis to roll along

Returns

shifted numpy array

Return type

ndarray

sigpyproc.utils.nearest_factor(num, fac)

Find nearest factor Calculates the factor of num, which is closest to fac.

Parameters
  • num (int) – number that we wish to factor

  • fac (int) – number around which we wish to find factor

Returns

nearest factor

Return type

int

sigpyproc.utils.get_logger(name, level=20, quiet=False)

Get a fancy logging utility using Rich library.

Parameters
  • name (str) – logger name

  • level (int or str, optional) – logging level, by default logging.INFO

  • quiet (bool, optional) – if True set level as logging.WARNING, by default False

Returns

a logging object

Return type

logging.Logger

sigpyproc.utils.time_after_nsamps(tstart, tsamp, nsamps=0)

Get precise time nsamps after input tstart. If nsamps is not given then just return tstart.

Parameters
  • tstart (float) – starting mjd.

  • tsamp (float) – sampling time in seconds.

  • nsamps (int, optional) – number of samples, by default 0

Returns

Astropy Time object after given nsamps

Return type

Time