12 December 2020

SPACEKIT Analyzer: frequency spectrographs

by Ru Kein

Plotting a SpecGram

Taking our previous analysis one step further, we might also be interested in transforming our signal from the time domain into the frequency domain. We can take the same data as before to generate and save spectrographs of our flux signal frequencies.

from spacekit.analyzer.explore import SignalPlots
sp = SignalPlots(show=True)
fits_file = os.path.join(data, 'ktwo206181769-c03_llc.fits')
_, flux = sp.read_ts_signal(fits_file, signal_col="sap_flux")
sp.flux_specs(flux, cmap="plasma", num="206181769")
k2 light curve frequency specgram

SpecGrams for Machine Learning Image Classification

If we want to use the plots for machine learning image classification, we can make them frameless with no axes so the inputs are raw RGB color values.

sp.flux_specs(flux, cmap="plasma", save_for_ML=True,fname="c03-206181769-ml.png")
k2 light curve frequency specgram for ML image classification

Finally, it’s also possible to generate these in grayscale by leaving out the color map kwarg - this can be beneficial for reducing memory usage with ML use cases in particular.

sp.flux_specs(flux, save_for_ML=True,fname="c03-206181769-bw.png")
k2 light curve frequency specgram grayscale

Contact

If you want to contact me you can send a message on LinkedIn.

License

This project uses the following license: MIT License.

  
            /\    _       _                           _                      * 
   /\_/\___/  \__| |_____| |_________________________| |___________________*___
   [===]  / /\ \ | |  _  |  _  | _  \/ __/ -__|  \| \_  _/ _  \ \_/ | * _/| | |
    \./  /_/  \_\|_|  ___|_| |_|__/\_\ \ \____|_|\__| \__/__/\_\___/|_|\_\|_|_|
                   | /             |___/                                       
                   |/