deshima_sensitivity.filter module#
- eta_filter_csv(file: str) Tuple[ndarray, ndarray, ndarray, ndarray, ndarray, Union[ndarray, List[float], List[int], float, int], Union[ndarray, List[float], List[int], float, int], Union[ndarray, List[float], List[int], float, int]] [source]#
Read filter transmissionsfrom csv and return filter matrix, integrationbins and integration bin bandwith
- Parameters:
file (str) – A string to the location of the .csv file .csv has headers of frequency bins (in GHz) and rows of channels
- Returns:
eta_filter – The filter transmission as an m x n matrix m: the number of integration bins. n: the number of filter channels. Units: None.
eta_inband – Whether a frequency is out- (false) or inband (true) as an m x n matrix m: the number of integration bins. n: the number of filter channels. Units: None.
F – Center frequency of each channel
F_int – The integration bins. Units: Hz.
F_W_int – The integration bandwith. units: Hz.
box_height – The transmission of the box-filter approximation. Units: None.
box_width – The bandwidth of the box-filter approximation. Units: Hz
chi_sqr – The Chi Square value of the Lorentzian fit. Units: None.
- Return type:
Tuple[ndarray, ndarray, ndarray, ndarray, ndarray, Union[ndarray, List[float], List[int], float, int], Union[ndarray, List[float], List[int], float, int], Union[ndarray, List[float], List[int], float, int]]
- eta_filter_lorentzian(F: Union[ndarray, List[float], List[int], float, int], FWHM: Union[ndarray, List[float], List[int], float, int], eta_circuit: Union[ndarray, List[float], List[int], float, int] = 1, F_res: int = 30, overflow: int = 80) Tuple[ndarray, ndarray, ndarray, ndarray, ndarray, Union[ndarray, List[float], List[int], float, int], Union[ndarray, List[float], List[int], float, int], Union[ndarray, List[float], List[int], float, int]] [source]#
- Calculate the filter transmissions as a matrix of
Lorentzian approximations. Also calculates approximating box filter
- Parameters:
F (Union[ndarray, List[float], List[int], float, int]) – Center frequency of the filter channels. Units: Hz (works also for GHz, will detect)
FWHM (Union[ndarray, List[float], List[int], float, int]) – Full width at half maximum of the filter channels. Units: same as F.
eta_circuit (Union[ndarray, List[float], List[int], float, int]) – Average transmission over the FWHM. Equal to pi/4 times the peak transmission Units: none.
F_res (int) – The number of frequency bins within a FWHM Units: none.
Overflow – The number of extra FHWM’s below the first and above the last channel Units: none.
overflow (int) –
- Returns:
eta_filter – The filter transmission as an m x n matrix m: the number of integration bins. n: the number of filter channels. Units: None.
eta_inband – Whether a frequency is out- (false) or inband (true) as an m x n matrix m: the number of integration bins. n: the number of filter channels. Units: None.
F_int – Frequency integration bins. Units: Hz.
W_F_int – Integration bandwith bins. Units: Hz.
box_height – The transmission of the box-filter approximation. Units: None.
box-width – The bandwidth of the box-filter approximation. Units: Hz.
chi-sq – Zero. For compatibility with the .csv fit Units: None.
- Return type:
Tuple[ndarray, ndarray, ndarray, ndarray, ndarray, Union[ndarray, List[float], List[int], float, int], Union[ndarray, List[float], List[int], float, int], Union[ndarray, List[float], List[int], float, int]]
- eta_inband_mask(F_int: ndarray, F: ndarray, HWHM: ndarray) ndarray [source]#
Generates an array to use with weighted_average() that averages over in-band (F +- HWHM) frequencies
- Parameters:
F_int (ndarray) – Frequency bins for integration. units: Hz or GHz.
F (ndarray) – Center frequencies of channels. units: Same as F_int.
HWHM (ndarray) – Half width at half maximum of these channels units: Same as F_int.
- Returns:
Whether a frequency is out- (false) or inband (true) as an m x n matrix m: the number of integration bins. n: the number of filter channels. Units: None.
- Return type:
eta_inband
- expand_F(F: Union[ndarray, List[float], List[int], float, int], FHWM: Union[ndarray, List[float], List[int], float, int], F_res: int = 30, overflow: int = 80) Tuple[ndarray, ndarray] [source]#
Expands the given channel(s) to create frequency bins over which to integrate.
If a single channel is given the function will expand by 2 * overflow * R using 2 * F_res * Overflow bins
- Parameters:
F (Union[ndarray, List[float], List[int], float, int]) – Center Frequency of filter channel Units: Hz (works also for GHz, will detect).
FHWM (Union[ndarray, List[float], List[int], float, int]) – The full width at half maximum, given by F/R. Units: same as F.
F_res (int) – The number of frequency bins within a FWHM Units: none.
Overflow – The number of extra FHWM’s below the first and above the last channel Units: none.
overflow (int) –
- Returns:
F_int – Frequency bins for later integration. units: Hz.
W_F_int – Bandwith of each frequency bin. units: Hz.
- Return type:
Tuple[ndarray, ndarray]
- fit_lorentzian(y: ndarray, x: ndarray) ndarray [source]#
Fits profile to lorentzian. Used with np.apply_along_axis.
- Parameters:
y (ndarray) – y values of profile to be fitted. Units: none.
x (ndarray) – x values of profiles to be fitted Units: Hz.
- Returns:
A numpy array of the returning parameters [‘Center’, ‘HWHM’, ‘max height’, ‘chi sq’]. Units: [same as x, same as x, None, None].
- Return type:
result_params
- weighted_average(var: Union[ndarray, List[float], List[int], float, int], eta_filter: ndarray) Union[ndarray, List[float], List[int], float, int] [source]#
Returns the average of a variable over the filter channels
- Parameters:
var (Union[ndarray, List[float], List[int], float, int]) – A variable varying over the frequency range. Units: varying.
eta_filter (ndarray) – The filter transmission as an m x n matrix m: the number of integration bins. n: the number of filter channels. Units: None.
- Returns:
The average of var over each filter channel. Units: same as var.
- Return type:
average