dqrtasks.gspynettree.utils
Functions
|
Combine 4 input images in 2x2 grid |
|
|
|
Render matplotlib figure and extract plot as image |
|
Forward Mercator transform function |
|
Generates a plot name using the convention {IFO}-{DESCRIPTOR}-{START_GPS}-{DURATION}{FMT} |
|
Returns a list of lists [Class name, string representing probability visually, probability] representing the results that the CNN outputs. |
|
Get logger according to commandline args |
|
Returns the calculated p-value of an event, where 0 is "DQ issue identified" and 1 is "no DQ issue identified". |
|
Checks if GPS time interval (start, end) at the specified detector is in observing mode |
|
Inverse Mercator transform function |
|
Makes a directory if it doesn't already exist |
|
Convert time series strain data to Q-transform spectrogram plot |
|
- dqrtasks.gspynettree.utils.collate_4_images(images, image_shape=(140, 170))[source]
Combine 4 input images in 2x2 grid
Arguments: images – list of 4 images
Keyword arguments: image_shape – dimensions of input images (default: (140, 170))
- dqrtasks.gspynettree.utils.fig_to_img(fig, height=1.78, width=2.39, xcrop=(20, 160), ycrop=(31, 201), greyscale=True)[source]
Render matplotlib figure and extract plot as image
- dqrtasks.gspynettree.utils.generate_plot_filename(ifo, desc, start_gps, duration, plot_fmt='.png')[source]
Generates a plot name using the convention {IFO}-{DESCRIPTOR}-{START_GPS}-{DURATION}{FMT}
- dqrtasks.gspynettree.utils.get_label_probabilities(prediction)[source]
Returns a list of lists [Class name, string representing probability visually, probability] representing the results that the CNN outputs. Params: prediction - CNN output with probabilities per class
- dqrtasks.gspynettree.utils.get_pvalue(prediction)[source]
Returns the calculated p-value of an event, where 0 is “DQ issue identified” and 1 is “no DQ issue identified”. The p-value is defined as 1 - maximum probability of all glitches. Params: prediction - CNN output with probabilities per class
- dqrtasks.gspynettree.utils.in_observing_mode(detector, start, end)[source]
Checks if GPS time interval (start, end) at the specified detector is in observing mode
- dqrtasks.gspynettree.utils.make_new_dir(dir)[source]
Makes a directory if it doesn’t already exist
params: - dir (os.path or string): path to the directory of interest
return: n/a
- dqrtasks.gspynettree.utils.plot_qtransform(detector, channel, gps_time, timeseries_path=None, plot_normalized_energy_range=[0, 25.5], plot_durations=[0.5, 1, 2, 4], frametype=None, framesource=None, qrange=(4, 64), frange=(10, 2048), cmap='Greys_r', yscale_kwargs={'base': 2, 'value': 'log'}, make_plots=False, tag='', output_dir=None, **kwargs)[source]
Convert time series strain data to Q-transform spectrogram plot
Arguments: detector – identifier for gravitational wave detector channel – identifier for data channel within gravitational wave detector gps_time – GPS time of interest
Keyword arguments: timeseries_path – path to cached gwpy.TimeSeries corresponding to event of interest
If not provided, gwpy.TimeSeries.get is used to get the data remotely
plot_normalized_energy_range – normalized energy range for Q-transform colourbar plot_durations – time windows centered around start_time to plot Q-transforms for qrange – Q range for Q-transform frange – frequency range for Q-transform cmap – matplotlib colour map to use for displaying Q-transform yscale_kwargs – keyword argument dictionary to pass into Axis.set_yscale make_plots – whether or not to make an overall plot combining individual Q-transforms tag – string tag to append to plot titles output_dir – directory to save plots to (default: plots are not saved)
Returns an array of pixel arrays corresponding to Q-transform plots, and additionally the Figure objects of the plotted figures if make_plots=True