def test_create_glob_kw(): PATTERN = os.path.join( os.path.dirname(CALLISTO_IMAGE), "BIR_*" ) ca = CallistoSpectrogram.create(pattern=PATTERN)[0] assert np.array_equal(ca, CallistoSpectrogram.read(CALLISTO_IMAGE))
def test_create_single_glob(): PATTERN = os.path.join( os.path.dirname(CALLISTO_IMAGE), "BIR_*" ) ca = CallistoSpectrogram.create(PATTERN) assert np.array_equal(ca.data, CallistoSpectrogram.read(CALLISTO_IMAGE).data)
def test_create_url_kw(): URL = ( "http://soleil.i4ds.ch/solarradio/data/2002-20yy_Callisto/2011/09/22/" "BIR_20110922_050000_01.fit.gz" ) ca = CallistoSpectrogram.create(url=URL) assert np.array_equal(ca, CallistoSpectrogram.read(URL))
def test_create_glob_kw(CALLISTO_IMAGE, CALLISTO_IMAGE_GLOB_INDEX, CALLISTO_IMAGE_GLOB_KEY): PATTERN = os.path.join( os.path.dirname(CALLISTO_IMAGE), CALLISTO_IMAGE_GLOB_KEY ) ca = CallistoSpectrogram.create(pattern=PATTERN)[CALLISTO_IMAGE_GLOB_INDEX] assert_allclose(ca.data, CallistoSpectrogram.read(CALLISTO_IMAGE).data)
def test_create_glob_kw(): PATTERN = os.path.join( os.path.dirname(CALLISTO_IMAGE), "BIR_*" ) ca = CallistoSpectrogram.create(pattern=PATTERN)[0] assert np.array_equal(ca.data, CallistoSpectrogram.read(CALLISTO_IMAGE).data)
def test_create_url_kw(): URL = ( "http://soleil.i4ds.ch/solarradio/data/2002-20yy_Callisto/2011/09/22/" "BIR_20110922_050000_01.fit.gz" ) ca = CallistoSpectrogram.create(url=URL) assert np.array_equal(ca.data, CallistoSpectrogram.read(URL).data)
def test_create_single_glob(CALLISTO_IMAGE, CALLISTO_IMAGE_GLOB_INDEX, CALLISTO_IMAGE_GLOB_KEY): PATTERN = os.path.join(os.path.dirname(CALLISTO_IMAGE), CALLISTO_IMAGE_GLOB_KEY) ca = CallistoSpectrogram.create(PATTERN) assert_allclose(ca[CALLISTO_IMAGE_GLOB_INDEX].data, CallistoSpectrogram.read(CALLISTO_IMAGE).data)
def test_read(CALLISTO_IMAGE): ca = CallistoSpectrogram.read(CALLISTO_IMAGE) assert ca.start == datetime(2011, 9, 22, 5, 0, 0, 454000) assert ca.t_init == 18000.0 assert ca.shape == (200, 3600) assert ca.t_delt == 0.25 # Test linearity of time axis. assert np.array_equal(ca.time_axis, np.linspace(0, 0.25 * (ca.shape[1] - 1), ca.shape[1])) assert ca.dtype == np.uint8
def test_read(CALLISTO_IMAGE): ca = CallistoSpectrogram.read(CALLISTO_IMAGE) assert ca.start == datetime(2011, 9, 22, 5, 0, 0, 454000) assert ca.t_init == 18000.0 assert ca.shape == (200, 3600) assert ca.t_delt == 0.25 # Test linearity of time axis. assert np.array_equal( ca.time_axis, np.linspace(0, 0.25 * (ca.shape[1] - 1), ca.shape[1])) assert ca.dtype == np.uint8
def test_create_file(): ca = CallistoSpectrogram.create(CALLISTO_IMAGE) assert np.array_equal(ca, CallistoSpectrogram.read(CALLISTO_IMAGE))
import numpy as np import sunpy.data.sample from sunpy.lightcurve import LightCurve times = np.arange(1000) * 2.0 signal = np.sin(np.arange(1000) * 0.02) + np.random.random(1000) light_curve = LightCurve.create({"signal": signal}, index=times) light_curve.peek() # endregion # region Description import matplotlib.pyplot as plt import sunpy.spectra plt.ion import sunpy.data.sample from sunpy.spectra.sources.callisto import CallistoSpectrogram image = CallistoSpectrogram.read(sunpy.data.sample.CALLISTO_IMAGE) image.peek() # endregion # region Description import sunpy.map import matplotlib.pyplot as plt import sunpy.data.sample plt.ion aia = sunpy.map.Map(sunpy.data.sample.AIA_171_IMAGE) fig = plt.figure() ax = plt.subplot(111) aia.plot() aia.draw_limb() aia.draw_grid() plt.colorbar()
def test_create_single_glob(CALLISTO_IMAGE, CALLISTO_IMAGE_GLOB_INDEX, CALLISTO_IMAGE_GLOB_KEY): PATTERN = os.path.join(os.path.dirname(CALLISTO_IMAGE), CALLISTO_IMAGE_GLOB_KEY) ca = CallistoSpectrogram.create(PATTERN) assert_allclose(ca[CALLISTO_IMAGE_GLOB_INDEX].data, CallistoSpectrogram.read(CALLISTO_IMAGE).data)
def test_create_glob_kw(CALLISTO_IMAGE, CALLISTO_IMAGE_GLOB_INDEX, CALLISTO_IMAGE_GLOB_KEY): PATTERN = os.path.join(os.path.dirname(CALLISTO_IMAGE), CALLISTO_IMAGE_GLOB_KEY) ca = CallistoSpectrogram.create(pattern=PATTERN)[CALLISTO_IMAGE_GLOB_INDEX] assert_allclose(ca.data, CallistoSpectrogram.read(CALLISTO_IMAGE).data)
def test_create_file(): ca = CallistoSpectrogram.create(CALLISTO_IMAGE) assert np.array_equal(ca.data, CallistoSpectrogram.read(CALLISTO_IMAGE).data)
def test_create_single_glob(): PATTERN = os.path.join(os.path.dirname(CALLISTO_IMAGE), "BIR_*") ca = CallistoSpectrogram.create(PATTERN) assert np.array_equal(ca, CallistoSpectrogram.read(CALLISTO_IMAGE))
def test_create_file_kw(): ca = CallistoSpectrogram.create(filename=CALLISTO_IMAGE) assert np.array_equal(ca, CallistoSpectrogram.read(CALLISTO_IMAGE))
def test_create_file_kw(CALLISTO_IMAGE): ca = CallistoSpectrogram.create(filename=CALLISTO_IMAGE) assert np.array_equal(ca.data, CallistoSpectrogram.read(CALLISTO_IMAGE).data)