Examples

First, we need to import the Generator module and instatiate a Generator object.

from TNAgen import Generator
generator = Generator.Generator()

To find a list of the names of glitches that can be generated, along with example spectrograms of each glitch, go to the Glitch Names tab.

Generating and saving 50 Koi Fish glitches as images of spectrograms:

generator.generate("Koi_Fish", 50)
generator.save_as_png("path/to/file", clear_queue=True)

Generating and saving 2 of each glitch, each with a SNR of 12, and saving as time-series in a gwf file:

generator.generate_all(2, SNR=12)
generator.save_as_timeseries("path/to/file", "name", format="gwf", clear_queue=True)

Generating and saving 96 Blip glitches and saving as time-series in a gwf file:

generator.generate("Blip", 96, SNR='realistic')
generator.save_as_timeseries("path/to/file", "name", format="hdf5", clear_queue=True)

Generating raw data (numpy arrays) for 50 Chirp glitches:

numpy_array, label_list = generator.generate("Chirp", 50)
generator.clear_queue()

Generating raw data (numpy arrays) for 25 Tomte glitches (SNR 12) and 25 Blip glitches (SNR 12, normally distributed) and saving them to a hdf5 file:

generator.generate("Tomte", 25, SNR=12.)
generator.generate("Blip", 25, SNR=np.random.Generator.normal(12, 2, 25))
generator.save_as_array("path/to/file", "name")