blimpy.calib_utils package

Submodules

blimpy.calib_utils.calib_plots module

blimpy.calib_utils.calib_plots.get_diff(dio_cross, feedtype, **kwargs)

Returns ON-OFF for all Stokes parameters given a cross_pols noise diode measurement

blimpy.calib_utils.calib_plots.plot_Stokes_diode(dio_cross, diff=True, feedtype='l', **kwargs)

Plots the uncalibrated full stokes spectrum of the noise diode. Use diff=False to plot both ON and OFF, or diff=True for ON-OFF

blimpy.calib_utils.calib_plots.plot_calibrated_diode(dio_cross, chan_per_coarse=8, feedtype='l', **kwargs)

Plots the corrected noise diode spectrum for a given noise diode measurement after application of the inverse Mueller matrix for the electronics chain.

blimpy.calib_utils.calib_plots.plot_diode_fold(dio_cross, bothfeeds=True, feedtype='l', min_samp=-500, max_samp=7000, legend=True, **kwargs)

Plots the calculated average power and time sampling of ON (red) and OFF (blue) for a noise diode measurement over the observation time series

blimpy.calib_utils.calib_plots.plot_diodespec(ON_obs, OFF_obs, calflux, calfreq, spec_in, units='mJy', **kwargs)

Plots the full-band Stokes I spectrum of the noise diode (ON-OFF)

blimpy.calib_utils.calib_plots.plot_fullcalib(dio_cross, feedtype='l', **kwargs)

Generates and shows five plots: Uncalibrated diode, calibrated diode, fold information, phase offsets, and gain offsets for a noise diode measurement. Most useful diagnostic plot to make sure calibration proceeds correctly.

blimpy.calib_utils.calib_plots.plot_gain_offsets(dio_cross, dio_chan_per_coarse=8, feedtype='l', ax1=None, ax2=None, legend=True, **kwargs)

Plots the calculated gain offsets of each coarse channel along with the time averaged power spectra of the X and Y feeds

blimpy.calib_utils.calib_plots.plot_phase_offsets(dio_cross, chan_per_coarse=8, feedtype='l', ax1=None, ax2=None, legend=True, **kwargs)

Plots the calculated phase offsets of each coarse channel along with the UV (or QU) noise diode spectrum for comparison

blimpy.calib_utils.fluxcal module

blimpy.calib_utils.fluxcal.Jy_to_Kelvin(flux, freqs)

Convert flux spectrum in Jy/beam to temperature units. Frequency inputs in MHz.

Parameters:
  • flux (1D Array (float)) – Spectrum over frequency band in Jy
  • freqs (1D Array (float)) – Frequencies (in MHz)
blimpy.calib_utils.fluxcal.calibrate_fluxes(main_obs_name, dio_name, dspec, Tsys, fullstokes=False, **kwargs)

Produce calibrated Stokes I for an observation given a noise diode measurement on the source and a diode spectrum with the same number of coarse channels

Parameters:
  • main_obs_name (str) – Path to filterbank file containing final data to be calibrated
  • dio_name (str) – Path to filterbank file for observation on the target source with flickering noise diode
  • dspec (1D Array (float) or float) – Coarse channel spectrum (or average) of the noise diode in Jy (obtained from diode_spec())
  • Tsys (1D Array (float) or float) – Coarse channel spectrum (or average) of the system temperature in Jy
  • fullstokes (boolean) – Use fullstokes=True if data is in IQUV format or just Stokes I, use fullstokes=False if it is in cross_pols format
blimpy.calib_utils.fluxcal.diode_spec(calON_obs, calOFF_obs, calflux, calfreq, spec_in, average=True, oneflux=False, **kwargs)

Calculate the coarse channel spectrum and system temperature of the noise diode in Jy given two noise diode measurements ON and OFF the calibrator source with the same frequency and time resolution

Parameters:
  • calON_obs (str) – (see f_ratios() above)
  • calOFF_obs (str) – (see f_ratios() above)
  • calflux (float) – Known flux of calibrator source at a particular frequency
  • calfreq (float) – Frequency where calibrator source has flux calflux (see above)
  • spec_in (float) – Known power-law spectral index of calibrator source. Use convention flux(frequency) = constant * frequency^(spec_in)
  • average (boolean) – Use average=True to return noise diode and Tsys spectra averaged over frequencies
blimpy.calib_utils.fluxcal.f_ratios(calON_obs, calOFF_obs, chan_per_coarse, **kwargs)

Calculate f_ON, and f_OFF as defined in van Straten et al. 2012 equations 2 and 3

Parameters:
  • calON_obs (str) – Path to filterbank file (any format) for observation ON the calibrator source
  • calOFF_obs (str) – Path to filterbank file (any format) for observation OFF the calibrator source
blimpy.calib_utils.fluxcal.foldcal(data, tsamp, diode_p=0.04, numsamps=1000, switch=False, inds=False)

Returns time-averaged spectra of the ON and OFF measurements in a calibrator measurement with flickering noise diode

Parameters:
  • data (2D Array object (float)) – 2D dynamic spectrum for data (any Stokes parameter) with flickering noise diode.
  • tsamp (float) – Sampling time of data in seconds
  • diode_p (float) – Period of the flickering noise diode in seconds
  • numsamps (int) – Number of samples over which to average noise diode ON and OFF
  • switch (boolean) – Use switch=True if the noise diode “skips” turning from OFF to ON once or vice versa
  • inds (boolean) – Use inds=True to also return the indexes of the time series where the ND is ON and OFF
blimpy.calib_utils.fluxcal.get_Tsys(calON_obs, calOFF_obs, calflux, calfreq, spec_in, **kwargs)

Returns frequency dependent system temperature given observations on and off a calibrator source

Parameters:diode_spec()) ((See) –
blimpy.calib_utils.fluxcal.get_Tsys_nodiode(calON_obs_name, calOFF_obs_name, calflux, calfreq, spec_in)

Calculates system temperature from two flux calibrator scans taken without noise diode flickering. CURRENTLY ONLY IMPLEMENTED FOR STOKES I DATA.

Parameters:
  • calON_obs_name (str) – Path to filterbank file for scan ON calibrator target
  • calOFF_obs_name (str) – Path to filterbank file for scan OFF calibrator
  • calflux (float) – Flux in Jy of the calibrator source
  • calfreq (float or int) – Frequency at which calflux was taken (MHz)
  • spec_in (float) – Spectral index of this calibrator
blimpy.calib_utils.fluxcal.get_calfluxes(calflux, calfreq, spec_in, centerfreqs, oneflux)

Given properties of the calibrator source, calculate fluxes of the source in a particular frequency range

Parameters:
  • calflux (float) – Known flux of calibrator source at a particular frequency
  • calfreq (float) – Frequency where calibrator source has flux calflux (MHz) (see above)
  • spec_in (float) – Known power-law spectral index of calibrator source. Use convention flux(frequency) = constant * frequency^(spec_in)
  • centerfreqs (1D Array (float)) – Central frequency values of each coarse channel
  • oneflux (boolean) – Use oneflux to choose between calculating the flux for each core channel (False) or using one value for the entire frequency range (True)
blimpy.calib_utils.fluxcal.get_centerfreqs(freqs, chan_per_coarse)

Returns central frequency of each coarse channel

Parameters:
  • freqs (1D Array (float)) – Frequency values for each bin of the spectrum
  • chan_per_coarse (int) – Number of frequency bins per coarse channel
blimpy.calib_utils.fluxcal.integrate_calib(name, chan_per_coarse, fullstokes=False, **kwargs)

Folds Stokes I noise diode data and integrates along coarse channels

Parameters:
  • name (str) – Path to noise diode filterbank file
  • chan_per_coarse (int) – Number of frequency bins per coarse channel
  • fullstokes (boolean) – Use fullstokes=True if data is in IQUV format or just Stokes I, use fullstokes=False if it is in cross_pols format
blimpy.calib_utils.fluxcal.integrate_chans(spec, chan_per_coarse)

Integrates over each core channel of a given spectrum. Important for calibrating data with frequency/time resolution different from noise diode data

Parameters:
  • spec (1D Array (float)) – Spectrum (any Stokes parameter) to be integrated
  • chan_per_coarse (int) – Number of frequency bins per coarse channel

blimpy.calib_utils.stokescal module

blimpy.calib_utils.stokescal.apply_Mueller(I, Q, U, V, gain_offsets, phase_offsets, chan_per_coarse, feedtype='l')

Returns calibrated Stokes parameters for an observation given an array of differential gains and phase differences.

blimpy.calib_utils.stokescal.calibrate_pols(cross_pols, diode_cross, obsI=None, onefile=True, feedtype='l', **kwargs)

Write Stokes-calibrated filterbank file for a given observation with a calibrator noise diode measurement on the source

Parameters:
  • cross_pols (string) – Path to cross polarization filterbank file (rawspec output) for observation to be calibrated
  • diode_cross (string) – Path to cross polarization filterbank file of noise diode measurement ON the target
  • obsI (string) – Path to Stokes I filterbank file of main observation (only needed if onefile=False)
  • onefile (boolean) – True writes all calibrated Stokes parameters to a single filterbank file, False writes four separate files
  • feedtype ('l' or 'c') – Basis of antenna dipoles. ‘c’ for circular, ‘l’ for linear
blimpy.calib_utils.stokescal.convert_to_coarse(data, chan_per_coarse)

Converts a data array with length n_chans to an array of length n_coarse_chans by averaging over the coarse channels

blimpy.calib_utils.stokescal.fracpols(cross_dat, **kwargs)

Output fractional linear and circular polarizations for a rawspec cross polarization .fil file. NOT STANDARD USE

blimpy.calib_utils.stokescal.gain_offsets(Idat, Qdat, Udat, Vdat, tsamp, chan_per_coarse, feedtype='l', **kwargs)

Determines relative gain error in the X and Y feeds for an observation given I and Q (I and V for circular basis) noise diode data.

blimpy.calib_utils.stokescal.get_stokes(cross_dat, feedtype='l')

Output stokes parameters (I,Q,U,V) for a rawspec cross polarization filterbank file

blimpy.calib_utils.stokescal.phase_offsets(Idat, Qdat, Udat, Vdat, tsamp, chan_per_coarse, feedtype='l', **kwargs)

Calculates phase difference between X and Y feeds given U and V (U and Q for circular basis) data from a noise diode measurement on the target

blimpy.calib_utils.stokescal.write_polfils(cross_dat, str_I, **kwargs)

Writes two new filterbank files containing fractional linear and circular polarization data

blimpy.calib_utils.stokescal.write_stokefils(cross_dat, str_I, Ifil=False, Qfil=False, Ufil=False, Vfil=False, Lfil=False, **kwargs)

Writes up to 5 new filterbank files corresponding to each Stokes parameter (and total linear polarization L) for a given cross polarization .fil file

Module contents