sigpyproc.core module#

sigpyproc.core.stats#

sigpyproc.core.stats.running_median(array, window)#

Calculate the running median of an array.

Parameters:

array (numpy.ndarray) – The array to calculate the running median of.

Returns:

The running median of the array.

Return type:

numpy.ndarray

sigpyproc.core.stats.running_mean(array, window)#

Calculate the running mean of an array.

Parameters:

array (numpy.ndarray) – The array to calculate the running mean of.

Returns:

The running mean of the array.

Return type:

numpy.ndarray

sigpyproc.core.stats.zscore_mad(array)#

Calculate the z-score of an array using the MAD (Modified z-score).

Parameters:

array (ArrayLike) – The array to calculate the modified z-score of.

Returns:

The modified z-score of the array.

Return type:

ndarray

sigpyproc.core.stats.zscore_double_mad(array)#

Calculate the modified z-score of an array using the Double MAD.

Parameters:

array (ArrayLike) – The array to calculate the modified z-score of.

Returns:

The modified z-score of the array.

Return type:

ndarray

class sigpyproc.core.stats.ChannelStats(nchans, nsamps)#

Bases: object

property mbag#

The central moments of the data.

Type:

MomentsBag

property nchans#

Get the number of channels.

Type:

int

property nsamps#

Get the number of samples.

Type:

int

property maxima#

Get the maximum value of each channel.

Type:

numpy.ndarray

property minima#

Get the minimum value of each channel.

Type:

numpy.ndarray

property mean#

Get the mean of each channel.

Type:

numpy.ndarray

property var#

Get the variance of each channel.

Type:

numpy.ndarray

property std#

Get the standard deviation of each channel.

Type:

numpy.ndarray

property skew#

Get the skewness of each channel.

Type:

numpy.ndarray

property kurtosis#

Get the kurtosis of each channel.

Type:

numpy.ndarray

push_data(array, gulp_size, start_index, mode='basic')#

sigpyproc.core.rfi#

sigpyproc.core.rfi.double_mad_mask(array, threshold=3)#

Calculate the mask of an array using the double MAD (Modified z-score).

Parameters:
  • array (ArrayLike) – The array to calculate the mask of.

  • threshold (float, optional) – Threshold in sigmas, by default 3.0

Returns:

The mask for the array.

Return type:

ndarray

Raises:

ValueError – If the threshold is not positive.

class sigpyproc.core.rfi.RFIMask(threshold, header, chan_mean, chan_var, chan_skew, chan_kurtosis, chan_maxima, chan_minima, chan_mask=_Nothing.NOTHING)#

Bases: object

threshold#
header#
chan_mean#
chan_var#
chan_skew#
chan_kurtosis#
chan_maxima#
chan_minima#
chan_mask#
property num_masked#

Number of masked channels.

Type:

int

property masked_fraction#

Fraction of channels masked.

Type:

float

apply_mask(chanmask)#

Apply a channel mask to the current mask.

Parameters:

chanmask (ArrayLike) – User channel mask to apply.

Raises:

ValueError – If the channel mask is not the same size as the current mask.

apply_method(method)#

Apply a mask method using channel statistics.

Parameters:

method (str) – Mask method to apply (iqrm, mad).

Raises:

ValueError – If the method is not supported.

apply_funcn(custom_funcn)#

Apply a custom function to the channel mask.

Parameters:

custom_funcn (Callable) – Custom function to apply to the mask.

Raises:

ValueError – If the custom_funcn is not callable.

to_file(filename=None)#

Write the mask to a HDF5 file.

Parameters:

filename (str, optional) – Filename to write the mask, by default None

Returns:

Filename written to.

Return type:

str

classmethod from_file(filename)#

Load a mask from a HDF5 file.

Parameters:

filename (str) – Filename to load the mask from.

Returns:

The loaded mask.

Return type:

RFIMask

sigpyproc.core.kernels#

sigpyproc.core.kernels.unpack1_8(array)#
sigpyproc.core.kernels.unpack2_8(array)#
sigpyproc.core.kernels.unpack4_8(array)#
sigpyproc.core.kernels.pack2_8(array)#
sigpyproc.core.kernels.pack4_8(array)#
sigpyproc.core.kernels.np_apply_along_axis(func1d, axis, arr)#
sigpyproc.core.kernels.np_mean(array, axis)#
sigpyproc.core.kernels.downcast(intype, result)#
sigpyproc.core.kernels.ol_downcast(intype, result)#
sigpyproc.core.kernels.downsample_1d(array, factor)#
sigpyproc.core.kernels.downsample_2d(array, tfactor, ffactor, nchans, nsamps)#
sigpyproc.core.kernels.extract_tim(inarray, outarray, nchans, nsamps, index)#
sigpyproc.core.kernels.extract_bpass(inarray, outarray, nchans, nsamps)#
sigpyproc.core.kernels.mask_channels(array, mask, maskvalue, nchans, nsamps)#
sigpyproc.core.kernels.dedisperse(inarray, outarray, delays, maxdelay, nchans, nsamps, index)#
sigpyproc.core.kernels.invert_freq(array, nchans, nsamps)#
sigpyproc.core.kernels.subband(inarray, outarray, delays, chan_to_sub, maxdelay, nchans, nsubs, nsamps)#
sigpyproc.core.kernels.fold(inarray, fold_ar, count_ar, delays, maxdelay, tsamp, period, accel, total_nsamps, nsamps, nchans, nbins, nints, nsubs, index)#
sigpyproc.core.kernels.resample_tim(array, accel, tsamp)#
sigpyproc.core.kernels.remove_zerodm(inarray, outarray, bpass, chanwts, nchans, nsamps)#
sigpyproc.core.kernels.form_spec(fft_ar, interpolated=False)#
sigpyproc.core.kernels.remove_rednoise(fftbuffer, startwidth, endwidth, endfreq, tsamp)#
sigpyproc.core.kernels.sum_harms(spec_arr, sum_arr, harm_arr, fact_arr, nharms, nsamps, nfold)#
class sigpyproc.core.kernels.MomentsBag(*args, **kwargs)#

Bases: MomentsBag

class_type = jitclass.MomentsBag#7f4711185df0<nchans:int32,m1:array(float32, 1d, A),m2:array(float32, 1d, A),m3:array(float32, 1d, A),m4:array(float32, 1d, A),min:array(float32, 1d, A),max:array(float32, 1d, A),count:array(int32, 1d, A)>#
sigpyproc.core.kernels.compute_online_moments_basic(array, bag, nsamps, startflag)#
sigpyproc.core.kernels.compute_online_moments(array, bag, nsamps, startflag)#

Computing central moments in one pass through the data.

sigpyproc.core.kernels.add_online_moments(bag_a, bag_b, bag_c)#