psd module¶
Review Status
Names |
Hash |
Date |
---|---|---|
Florent, Sathya, Duncan Me., Jolien, Kipp, Chad |
b3ef077fe87b597578000f140e4aa780f3a227aa |
2014-05-01 |
- class psd.HorizonDistance(f_min, f_max, delta_f, m1, m2, spin1=(0.0, 0.0, 0.0), spin2=(0.0, 0.0, 0.0), eccentricity=0.0, inclination=0.0, approximant='IMRPhenomD')[source]¶
Bases:
object
- psd.condition_psd(psd: REAL8FrequencySeries, newdeltaF: int, minfs: Optional[Tuple[int, int]] = (35.0, 40.0), maxfs: Optional[Tuple[int, int]] = (1800.0, 2048.0), smoothing_frequency: Optional[float] = 4.0, fir_whiten: Optional[bool] = False) REAL8FrequencySeries [source]¶
Condition a PSD suitable for whitening waveforms.
- Args:
- psd:
lal.REAL8FrequencySeries, the PSD to taper
- newdeltaF (Hz):
int, the target delta F to interpolate to
- minfs (Hz):
Tuple[float, float], optional, the frequency boundaries over which to taper the spectrum to infinity. i.e., frequencies below the first item in the tuple will have an infinite spectrum, the second item in the tuple will not be changed. A taper from 0 to infinity is applied in between.
- maxfs (Hz):
Tuple[float, float], optional, the frequency boundaries over which to taper the spectrum to infinity. i.e., frequencies above the second item in the tuple will have an infinite spectrum, the first item in the tuple will not be changed. A taper from 0 to infinity is applied in between.
- smoothing_frequency (Hz):
float, default = 4 Hz, the target frequency resolution after smoothing. Lines with bandwidths << smoothing_frequency are removed via a median calculation. Remaining features will be blurred out to this resolution.
- fir_whiten:
bool, default False, whether to enable causal whitening with a time-domain whitening kernel vs. traditional acausal whitening
- Returns:
lal.REAL8FrequencySeries, the conditioned PSD
- psd.effective_distance_factor(inclination, fp, fc)[source]¶
Returns the ratio of effective distance to physical distance for compact binary mergers. Inclination is the orbital inclination of the system in radians, fp and fc are the F+ and Fx antenna factors. See lal.ComputeDetAMResponse() for a function to compute antenna factors. The effective distance is given by
Deff = effective_distance_factor * D
See Equation (4.3) of arXiv:0705.1514.
- psd.harmonic_mean(psddict: Dict[str, REAL8FrequencySeries]) REAL8FrequencySeries [source]¶
Take the harmonic mean of a dictionary of PSDs.
- psd.interpolate_psd(psd: REAL8FrequencySeries, deltaF: int) REAL8FrequencySeries [source]¶
Interpolates a PSD to a target frequency resolution.
- Args:
- psd:
lal.REAL8FrequencySeries, the PSD to interpolate
- deltaF:
int, the target frequency resolution to interpolate to
- Returns:
lal.REAL8FrequencySeries, the interpolated PSD
- psd.measure_psd(gw_data_source_info, instrument, rate, psd_fft_length=8, verbose=False)[source]¶
Gstreamer graph
- psd.movingaverage(psd: ndarray, window_size: int) ndarray [source]¶
Smoothen a PSD with a moving average.
- Args:
- psd:
numpy.ndarray, the PSD to smoothen
- window_size:
int, the size of the window used for the moving median
- Returns:
the smoothened PSD
- psd.movingmedian(psd: Union[ndarray, REAL8FrequencySeries], window_size: int) Union[ndarray, REAL8FrequencySeries] [source]¶
Smoothen a PSD with a moving median.
Assumes that the underlying PSD doesn’t have variance, i.e., that there is no median / mean correction factor required.
- Args:
- psd:
Union[numpy.ndarray, lal.REAL8FrequencySeries], the PSD to smoothen
- window_size:
int, the size of the window used for the moving median
- Returns:
a smoothened PSD of same type as input PSD
- psd.polyfit(psd: REAL8FrequencySeries, f_low: float, f_high: float, order: int, verbose: Optional[bool] = False) REAL8FrequencySeries [source]¶
Fit a PSD to a polynomial.
- Args:
- psd:
lal.REAL8FrequencySeries, the PSD to fit
- f_low (Hz):
float, the low frequency to begin fitting with
- f_high (Hz):
float, the high frequency to stop fitting with
- order:
int, the order of the fitting polynomial
- verbose:
bool, default false, whether to display the fit
- Returns:
lal.REAL8FrequencySeries, the PSD fitted to a polynomial
- psd.read_asd_txt(filename: str, df: float = 0.25, zero_pad: bool = False, read_as_psd: bool = False) REAL8FrequencySeries [source]¶
Reads in a text-formatted ASD as a PSD.
- Args:
- filename:
str, the file to read ASD(s) from
- df (Hz):
float, default 0.25, the frequency resolution to interpolate to
- zero_pad:
bool, default False, whether to zero-pad PSD to 0 Hz if needed.
- read_as_psd:
bool, default False, whether to treat input as PSD rather than ASD
- Returns:
lal.REAL8FrequencySeries, the PSD
- psd.read_psd(filename: str, verbose: Optional[bool] = False) Dict[str, REAL8FrequencySeries] [source]¶
Reads in an XML-formatted PSD.
- Args:
- filename:
str, the file to read PSD(s) from
- verbose:
bool, default False, whether to display logging messages
- Returns:
a dictionary of lal FrequencySeries keyed by instrument
- psd.taperzero_fseries(fseries: REAL8FrequencySeries, minfs: Optional[Tuple[float, float]] = (35.0, 40.0), maxfs: Optional[Tuple[float, float]] = (1800.0, 2048.0)) REAL8FrequencySeries [source]¶
Taper the PSD to infinity for given min/max frequencies.
- Args:
- psd:
lal.REAL8FrequencySeries, the PSD to taper
- minfs (Hz):
Tuple[float, float], optional, the frequency boundaries over which to taper the spectrum to infinity. i.e., frequencies below the first item in the tuple will have an infinite spectrum, the second item in the tuple will not be changed. A taper from 0 to infinity is applied in between.
- maxfs (Hz):
Tuple[float, float], optional, the frequency boundaries over which to taper the spectrum to infinity. i.e., frequencies above the second item in the tuple will have an infinite spectrum, the first item in the tuple will not be changed. A taper from 0 to infinity is applied in between.
- Returns:
lal.REAL8FrequencySeries, the tapered PSD
- psd.write_asd_txt(filename: str, psd: REAL8FrequencySeries, verbose: Optional[bool] = False) None [source]¶
Writes an text-formatted ASD to disk.
- Args:
- filename:
str, the file to write ASD to
- psd:
lal.REAL8FrequencySeries, the PSD
- verbose:
bool, default False, whether to display logging messages
- psd.write_psd(filename: str, psddict: Dict[str, REAL8FrequencySeries], trap_signals: Optional[Iterable[Signals]] = None, verbose: Optional[bool] = False) None [source]¶
Writes an XML-formatted PSD to disk.
Wrapper around make_psd_xmldoc() to write the XML document directly to a named file.
- Args:
- filename:
str, the file to write PSD(s) to
- psds:
Dict[str, lal.REAL8FrequencySeries], the PSD(s)
- trap_signals:
Iterable[signal.Signal], optional, whether to attach extra signal handlers on write
- verbose:
bool, default False, whether to display logging messages