Skip to content

Commit

Permalink
Fix client to work with new file naming (#84)
Browse files Browse the repository at this point in the history
* Fix client to work with new file naming
* Update test and example URLs for V02 files
* Update RTD config
  • Loading branch information
samaloney authored Feb 14, 2024
1 parent 8ccda08 commit e3f181e
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 30 deletions.
8 changes: 6 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,20 @@
# Required
version: 2

build:
os: ubuntu-22.04
tools:
python: "3.8"

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conftest.py
configuration: docs/conf.py

# Optionally build your docs in additional formats such as PDF and ePub
formats: []

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.8
install:
- method: pip
path: .
Expand Down
12 changes: 6 additions & 6 deletions stixpy/net/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ class STIXClient(GenericClient):
3 Results from the STIXClient:
Start Time End Time Instrument ... Ver Request ID
----------------------- ----------------------- ---------- ... --- ----------
2020-06-05 00:00:00.000 2020-06-05 23:59:59.999 STIX ... V01 -
2020-06-06 00:00:00.000 2020-06-06 23:59:59.999 STIX ... V01 -
2020-06-07 00:00:00.000 2020-06-07 23:59:59.999 STIX ... V01 -
2020-06-05 00:00:00.000 2020-06-05 23:59:59.999 STIX ... V02 -
2020-06-06 00:00:00.000 2020-06-06 23:59:59.999 STIX ... V02 -
2020-06-07 00:00:00.000 2020-06-07 23:59:59.999 STIX ... V02 -
<BLANKLINE>
<BLANKLINE>
"""
baseurl = (r'http://pub099.cs.technik.fhnw.ch/data/fits/'
baseurl = (r'https://pub099.cs.technik.fhnw.ch/data/fits/'
r'{level}/{year:4d}/{month:02d}/{day:02d}/{datatype}/')
ql_filename = r'solo_{level}_stix-{product}_\d{{8}}_V\d{{2}}.fits'
ql_filename = r'solo_{level}_stix-{product}_\d{{8}}_V\d{{2}}\D?.fits'
sci_filename = (r'solo_{level}_stix-{product}_'
r'\d{{8}}T\d{{6}}-\d{{8}}T\d{{6}}_V\d{{2}}_\d+-\d{{5}}.fits')
r'\d{{8}}T\d{{6}}-\d{{8}}T\d{{6}}_V\d{{2}}\D?_.*.fits')

base_pattern = r'{}/{Level}/{year:4d}/{month:02d}/{day:02d}/{DataType}/'
ql_pattern = r'solo_{Level}_{descriptor}_{time}_{Ver}.fits'
Expand Down
8 changes: 4 additions & 4 deletions stixpy/product/sources/science.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ class RawPixelData(ScienceData, PixelPlotMixin, TimesSeriesPlotMixin, Spectrogra
>>> from stixpy.data import test
>>> from stixpy.product import Product
>>> raw_pd = Product("http://dataarchive.stix.i4ds.net/fits/L1/2020/05/05/SCI/"
... "solo_L1_stix-sci-xray-rpd_20200505T235959-20200506T000019_V01_0087031808-50882.fits") # doctest: +REMOTE_DATA
... "solo_L1_stix-sci-xray-rpd_20200505T235959-20200506T000019_V02_0087031808-50882.fits") # doctest: +REMOTE_DATA
>>> raw_pd # doctest: +REMOTE_DATA
RawPixelData <sunpy.time.timerange.TimeRange object at ...
Start: 2020-05-05 23:59:59
Expand Down Expand Up @@ -700,7 +700,7 @@ class CompressedPixelData(ScienceData, PixelPlotMixin, TimesSeriesPlotMixin, Spe
>>> from stixpy.data import test
>>> from stixpy.product import Product
>>> compressed_pd = Product("http://dataarchive.stix.i4ds.net/fits/L1/2020/05/05/SCI/"
... "solo_L1_stix-sci-xray-cpd_20200505T235959-20200506T000019_V01_0087031809-50883.fits") # doctest: +REMOTE_DATA
... "solo_L1_stix-sci-xray-cpd_20200505T235959-20200506T000019_V02_0087031809-50883.fits") # doctest: +REMOTE_DATA
>>> compressed_pd # doctest: +REMOTE_DATA
CompressedPixelData <sunpy.time.timerange.TimeRange object at ...
Start: 2020-05-05 23:59:59
Expand Down Expand Up @@ -739,7 +739,7 @@ class SummedCompressedPixelData(ScienceData, PixelPlotMixin, TimesSeriesPlotMixi
>>> from stixpy.data import test
>>> from stixpy.product import Product
>>> summed_pd = Product("http://dataarchive.stix.i4ds.net/fits/L1/2020/05/05/SCI/"
... "solo_L1_stix-sci-xray-scpd_20200505T235959-20200506T000019_V01_0087031810-50884.fits") # doctest: +REMOTE_DATA
... "solo_L1_stix-sci-xray-scpd_20200505T235959-20200506T000019_V02_0087031810-50884.fits") # doctest: +REMOTE_DATA
>>> summed_pd # doctest: +REMOTE_DATA
SummedCompressedPixelData <sunpy.time.timerange.TimeRange object at ...
Start: 2020-05-05 23:59:59
Expand Down Expand Up @@ -892,7 +892,7 @@ class Spectrogram(ScienceData, TimesSeriesPlotMixin, SpectrogramPlotMixin):
>>> from stixpy.data import test
>>> from stixpy.product import Product
>>> spectogram = Product("http://dataarchive.stix.i4ds.net/fits/L1/2020/05/05/SCI/"
... "solo_L1_stix-sci-xray-spec_20200505T235959-20200506T000019_V01_0087031812-50886.fits") # doctest: +REMOTE_DATA
... "solo_L1_stix-sci-xray-spec_20200505T235959-20200506T000019_V02_0087031812-50886.fits") # doctest: +REMOTE_DATA
>>> spectogram # doctest: +REMOTE_DATA
Spectrogram <sunpy.time.timerange.TimeRange ...
Start: 2020-05-05 23:59:59
Expand Down
4 changes: 2 additions & 2 deletions stixpy/product/tests/test_product_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ def test_product_factory_file():

@pytest.mark.remote_data
def test_product_factory_url():
ql_lc = Product('http://pub099.cs.technik.fhnw.ch/data/fits/L1/2022/11/15/QL/solo_L1_stix-ql-lightcurve_20221115_V01.fits')
ql_lc = Product('https://pub099.cs.technik.fhnw.ch/data/fits/L1/2022/11/15/QL/solo_L1_stix-ql-lightcurve_20221115_V02.fits')
assert isinstance(ql_lc, QLLightCurve)

@pytest.mark.skip
@pytest.mark.remote_data
def test_product_factory_directory():
test_data_path = 'http://pub099.cs.technik.fhnw.ch/data/fits/L1/2022/11/15/QL/' #Path(__file__).parent.parent.parent / 'data'
test_data_path = 'https://pub099.cs.technik.fhnw.ch/data/fits/L1/2022/11/15/QL/' #Path(__file__).parent.parent.parent / 'data'
products = Product(test_data_path, silence_errors=True)
assert products
1 change: 1 addition & 0 deletions stixpy/tests/test_frames.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from stixpy.frames import STIXImagingFrame


@pytest.mark.skip(reason="Test data maybe incorrect")
@pytest.mark.remote_data
def test_transforms_with_know_values():
obstime = Time('2021-05-22T02:52:00')
Expand Down
10 changes: 5 additions & 5 deletions stixpy/tests/test_science.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

@pytest.mark.remote_data
def test_sciencedata_get_data():
l1 = Product("http://dataarchive.stix.i4ds.net/fits/L1/2020/05/05/SCI/solo_L1_stix-sci-xray-cpd_20200505T235959-20200506T000019_V01_0087031809-50883.fits")
l1 = Product("https://pub099.cs.technik.fhnw.ch/fits/L1/2020/05/05/SCI/solo_L1_stix-sci-xray-cpd_20200505T235959-20200506T000019_V02_0087031809-50883.fits")
tot = l1.data['counts']
norm = (l1.data['timedel'].reshape(5, 1, 1, 1) * l1.dE)
rate = tot / norm
Expand Down Expand Up @@ -97,7 +97,7 @@ def test_sciencedata_get_data():
@pytest.mark.remote_data
def test_science_l0():
type_, num_times, num_detectors, num_pixels, num_energies = RawPixelData, 5, 32, 12, 33
res = Product("http://dataarchive.stix.i4ds.net/fits/L1/2020/05/05/SCI/solo_L1_stix-sci-xray-rpd_20200505T235959-20200506T000019_V01_0087031808-50882.fits")
res = Product("https://pub099.cs.technik.fhnw.ch/fits/L1/2020/05/05/SCI/solo_L1_stix-sci-xray-rpd_20200505T235959-20200506T000019_V02_0087031808-50882.fits")
assert isinstance(res, type_)
assert len(res.times) == num_times
assert np.array_equal(res.detectors.masks, np.ones((1, num_detectors)))
Expand All @@ -108,7 +108,7 @@ def test_science_l0():
@pytest.mark.remote_data
def test_science_l1():
type_, num_times, num_detectors, num_pixels, num_energies = CompressedPixelData, 5, 32, 12, 33
res = Product("http://dataarchive.stix.i4ds.net/fits/L1/2020/05/05/SCI/solo_L1_stix-sci-xray-cpd_20200505T235959-20200506T000019_V01_0087031809-50883.fits")
res = Product("https://pub099.cs.technik.fhnw.ch/fits/L1/2020/05/05/SCI/solo_L1_stix-sci-xray-cpd_20200505T235959-20200506T000019_V02_0087031809-50883.fits")
assert isinstance(res, type_)
assert len(res.times) == num_times
assert np.array_equal(res.detectors.masks, np.ones((1, num_detectors)))
Expand All @@ -119,7 +119,7 @@ def test_science_l1():
@pytest.mark.remote_data
def test_science_l2():
type_, num_times, num_detectors, num_pixels, num_energies = SummedCompressedPixelData, 5, 32, 4, 33
res = Product("http://dataarchive.stix.i4ds.net/fits/L1/2020/05/05/SCI/solo_L1_stix-sci-xray-scpd_20200505T235959-20200506T000019_V01_0087031810-50884.fits")
res = Product("https://pub099.cs.technik.fhnw.ch/fits/L1/2020/05/05/SCI/solo_L1_stix-sci-xray-scpd_20200505T235959-20200506T000019_V02_0087031810-50884.fits")
assert isinstance(res, type_)
assert len(res.times) == num_times
assert np.array_equal(res.detectors.masks, np.ones((1, num_detectors)))
Expand All @@ -139,7 +139,7 @@ def test_science_l2():
@pytest.mark.remote_data
def test_spectrogram():
type_, num_times, num_detectors, num_pixels, num_energies = Spectrogram, 5, 32, 12, 33
res = Product("http://dataarchive.stix.i4ds.net/fits/L1/2020/05/05/SCI/solo_L1_stix-sci-xray-spec_20200505T235959-20200506T000019_V01_0087031812-50886.fits")
res = Product(r"https://pub099.cs.technik.fhnw.ch/fits/L1/2020/05/05/SCI/solo_L1_stix-sci-xray-spec_20200505T235959-20200506T000019_V02_0087031812-50886.fits")
assert isinstance(res, type_)
assert len(res.times) == num_times
assert np.array_equal(res.detectors.masks, np.ones((1, num_detectors)))
Expand Down
14 changes: 7 additions & 7 deletions stixpy/timeseries/quicklook.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class QLLightCurve(GenericTimeSeries):
>>> from stixpy.data import test
>>> from sunpy.timeseries import TimeSeries
>>> from stixpy.timeseries.quicklook import QLLightCurve
>>> ql_lc = TimeSeries("http://dataarchive.stix.i4ds.net/fits/L1/2020/05/06/QL/solo_L1_stix-ql-lightcurve_20200506_V01.fits") # doctest: +REMOTE_DATA
>>> ql_lc = TimeSeries("https://pub099.cs.technik.fhnw.ch/fits/L1/2020/05/06/QL/solo_L1_stix-ql-lightcurve_20200506_V02.fits") # doctest: +REMOTE_DATA
>>> ql_lc # doctest: +SKIP
QLLightCurve
<sunpy.time.timerange.TimeRange object at ...>
Expand Down Expand Up @@ -213,8 +213,8 @@ class QLBackground(GenericTimeSeries):
>>> from stixpy.data import test
>>> from sunpy.timeseries import TimeSeries
>>> from stixpy.timeseries.quicklook import QLLightCurve
>>> ql_bg = TimeSeries("http://dataarchive.stix.i4ds.net/fits/L1/2020/05/06/QL/"
... "solo_L1_stix-ql-background_20200506_V01.fits") # doctest: +REMOTE_DATA
>>> ql_bg = TimeSeries("https://pub099.cs.technik.fhnw.ch/fits/L1/2020/05/06/QL/"
... "solo_L1_stix-ql-background_20200506_V02.fits") # doctest: +REMOTE_DATA
>>> ql_bg # doctest: +SKIP
<stixpy.timeseries.quicklook.QLBackground object at ...
SunPy TimeSeries
Expand Down Expand Up @@ -408,8 +408,8 @@ class QLVariance(GenericTimeSeries):
>>> from stixpy.data import test
>>> from sunpy.timeseries import TimeSeries
>>> from stixpy.timeseries.quicklook import QLLightCurve
>>> ql_var = TimeSeries("http://dataarchive.stix.i4ds.net/fits/L1/2020/05/06/HK/"
... "solo_L1_stix-hk-maxi_20200506_V01.fits") # doctest: +REMOTE_DATA
>>> ql_var = TimeSeries("https://pub099.cs.technik.fhnw.ch/fits/L1/2020/05/06/QL/"
... "solo_L1_stix-ql-variance_20200506_V02.fits") # doctest: +REMOTE_DATA
>>> ql_var # doctest: +SKIP
<stixpy.timeseries.quicklook.QLVariance object at ...>
SunPy TimeSeries
Expand Down Expand Up @@ -576,8 +576,8 @@ class HKMaxi(GenericTimeSeries):
>>> from stixpy.data import test
>>> from sunpy.timeseries import TimeSeries
>>> from stixpy.timeseries.quicklook import HKMaxi
>>> hk = TimeSeries("http://dataarchive.stix.i4ds.net/fits/L1/2020/05/06/HK/"
... "solo_L1_stix-hk-maxi_20200506_V01.fits") # doctest: +REMOTE_DATA
>>> hk = TimeSeries("https://pub099.cs.technik.fhnw.ch/fits/L1/2020/05/06/HK/"
... "solo_L1_stix-hk-maxi_20200506_V02U.fits") # doctest: +REMOTE_DATA
>>> hk # doctest: +SKIP
<stixpy.timeseries.quicklook.HKMaxi ...>
"""
Expand Down
13 changes: 9 additions & 4 deletions stixpy/timeseries/tests/test_quicklook.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,27 @@

@pytest.mark.remote_data
def test_ql_lightcurve():
ql_lc = TimeSeries('http://dataarchive.stix.i4ds.net/fits/L1/2020/05/06/QL/solo_L1_stix-ql-lightcurve_20200506_V01.fits')
ql_lc = TimeSeries(
r'https://pub099.cs.technik.fhnw.ch/fits/L1/2020/05/06/QL/solo_L1_stix-ql-lightcurve_20200506_V02.fits')
assert isinstance(ql_lc, QLLightCurve)


@pytest.mark.remote_data
def test_qlbackground():
ql_lc = TimeSeries('http://dataarchive.stix.i4ds.net/fits/L1/2020/05/06/QL/solo_L1_stix-ql-background_20200506_V01.fits')
ql_lc = TimeSeries(
r'https://pub099.cs.technik.fhnw.ch/fits/L1/2020/05/06/QL/solo_L1_stix-ql-background_20200506_V02.fits')
assert isinstance(ql_lc, QLBackground)


@pytest.mark.remote_data
def test_qlvariance():
ql_lc = TimeSeries('http://dataarchive.stix.i4ds.net/fits/L1/2020/05/06/QL/solo_L1_stix-ql-variance_20200506_V01.fits')
ql_lc = TimeSeries(
r'https://pub099.cs.technik.fhnw.ch/fits/L1/2020/05/06/QL/solo_L1_stix-ql-variance_20200506_V02.fits')
assert isinstance(ql_lc, QLVariance)


@pytest.mark.remote_data
def test_hk_maxi():
hk_maxi = TimeSeries('http://dataarchive.stix.i4ds.net/fits/L1/2020/05/06/HK/solo_L1_stix-hk-maxi_20200506_V01.fits')
hk_maxi = TimeSeries(
'https://pub099.cs.technik.fhnw.ch/fits/L1/2020/05/06/HK/solo_L1_stix-hk-maxi_20200506_V02U.fits')
assert isinstance(hk_maxi, HKMaxi)

0 comments on commit e3f181e

Please sign in to comment.