seppy 0.1.15__tar.gz → 0.1.17__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of seppy might be problematic. Click here for more details.

Files changed (46) hide show
  1. {seppy-0.1.15/seppy.egg-info → seppy-0.1.17}/PKG-INFO +3 -3
  2. {seppy-0.1.15 → seppy-0.1.17}/README.rst +1 -1
  3. {seppy-0.1.15 → seppy-0.1.17}/requirements.txt +1 -0
  4. {seppy-0.1.15 → seppy-0.1.17}/seppy/loader/wind.py +16 -4
  5. {seppy-0.1.15 → seppy-0.1.17}/seppy/tests/test_tools.py +8 -8
  6. {seppy-0.1.15 → seppy-0.1.17}/seppy/util/__init__.py +7 -18
  7. {seppy-0.1.15 → seppy-0.1.17}/seppy/version.py +1 -1
  8. {seppy-0.1.15 → seppy-0.1.17/seppy.egg-info}/PKG-INFO +3 -3
  9. {seppy-0.1.15 → seppy-0.1.17}/LICENSE.rst +0 -0
  10. {seppy-0.1.15 → seppy-0.1.17}/MANIFEST.in +0 -0
  11. {seppy-0.1.15 → seppy-0.1.17}/docs/Makefile +0 -0
  12. {seppy-0.1.15 → seppy-0.1.17}/docs/conf.py +0 -0
  13. {seppy-0.1.15 → seppy-0.1.17}/docs/index.rst +0 -0
  14. {seppy-0.1.15 → seppy-0.1.17}/docs/make.bat +0 -0
  15. {seppy-0.1.15 → seppy-0.1.17}/licenses/LICENSE.rst +0 -0
  16. {seppy-0.1.15 → seppy-0.1.17}/licenses/SUNPY_LICENSE.rst +0 -0
  17. {seppy-0.1.15 → seppy-0.1.17}/licenses/TEMPLATE_LICENSE.rst +0 -0
  18. {seppy-0.1.15 → seppy-0.1.17}/pyproject.toml +0 -0
  19. {seppy-0.1.15 → seppy-0.1.17}/seppy/__init__.py +0 -0
  20. {seppy-0.1.15 → seppy-0.1.17}/seppy/data/test/20230719_side0.csv +0 -0
  21. {seppy-0.1.15 → seppy-0.1.17}/seppy/data/test/20230719_side1.csv +0 -0
  22. {seppy-0.1.15 → seppy-0.1.17}/seppy/data/test/20230719_side2.csv +0 -0
  23. {seppy-0.1.15 → seppy-0.1.17}/seppy/data/test/epi21106.rl2 +0 -0
  24. {seppy-0.1.15 → seppy-0.1.17}/seppy/data/test/sept_ahead_ele_sun_2006_318_1min_l2_v03.dat +0 -0
  25. {seppy-0.1.15 → seppy-0.1.17}/seppy/data/test/soho_erne-hed_l2-1min_20211028_v01.cdf +0 -0
  26. {seppy-0.1.15 → seppy-0.1.17}/seppy/data/test/solo_l2_mag-rtn-normal-1-minute_20210712_v01.cdf +0 -0
  27. {seppy-0.1.15 → seppy-0.1.17}/seppy/data/test/sta_l1_het_20211028_v01.cdf +0 -0
  28. {seppy-0.1.15 → seppy-0.1.17}/seppy/data/test/wi_sfsp_3dp_00000000_v01.cdf +0 -0
  29. {seppy-0.1.15 → seppy-0.1.17}/seppy/data/test/wi_sfsp_3dp_20200213_v01.cdf +0 -0
  30. {seppy-0.1.15 → seppy-0.1.17}/seppy/loader/psp.py +0 -0
  31. {seppy-0.1.15 → seppy-0.1.17}/seppy/loader/soho.py +0 -0
  32. {seppy-0.1.15 → seppy-0.1.17}/seppy/loader/solo.py +0 -0
  33. {seppy-0.1.15 → seppy-0.1.17}/seppy/loader/stereo.py +0 -0
  34. {seppy-0.1.15 → seppy-0.1.17}/seppy/tests/__init__.py +0 -0
  35. {seppy-0.1.15 → seppy-0.1.17}/seppy/tests/test_loader.py +0 -0
  36. {seppy-0.1.15 → seppy-0.1.17}/seppy/tools/__init__.py +0 -0
  37. {seppy-0.1.15 → seppy-0.1.17}/seppy/tools/swaves.py +0 -0
  38. {seppy-0.1.15 → seppy-0.1.17}/seppy/tools/widgets.py +0 -0
  39. {seppy-0.1.15 → seppy-0.1.17}/seppy.egg-info/SOURCES.txt +0 -0
  40. {seppy-0.1.15 → seppy-0.1.17}/seppy.egg-info/dependency_links.txt +0 -0
  41. {seppy-0.1.15 → seppy-0.1.17}/seppy.egg-info/not-zip-safe +0 -0
  42. {seppy-0.1.15 → seppy-0.1.17}/seppy.egg-info/requires.txt +0 -0
  43. {seppy-0.1.15 → seppy-0.1.17}/seppy.egg-info/top_level.txt +0 -0
  44. {seppy-0.1.15 → seppy-0.1.17}/setup.cfg +0 -0
  45. {seppy-0.1.15 → seppy-0.1.17}/setup.py +0 -0
  46. {seppy-0.1.15 → seppy-0.1.17}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: seppy
3
- Version: 0.1.15
3
+ Version: 0.1.17
4
4
  Summary: SEPpy
5
5
  Home-page: https://github.com/serpentine-h2020/SEPpy
6
6
  Author: Jan Gieseler
@@ -51,7 +51,7 @@ seppy
51
51
  .. |python version| image:: https://img.shields.io/pypi/pyversions/seppy?style=flat&logo=python
52
52
  .. |zenodo doi| image:: https://zenodo.org/badge/451799504.svg
53
53
  :target: https://zenodo.org/badge/latestdoi/451799504
54
- .. |pytest| image:: https://github.com/serpentine-h2020/SEPpy/workflows/pytest/badge.svg
54
+ .. |pytest| image:: https://github.com/serpentine-h2020/SEPpy/actions/workflows/pytest.yml/badge.svg?branch=main
55
55
  .. |codecov| image:: https://codecov.io/gh/serpentine-h2020/SEPpy/branch/main/graph/badge.svg?token=FYELM4Y7DF
56
56
  :target: https://codecov.io/gh/serpentine-h2020/SEPpy
57
57
 
@@ -8,7 +8,7 @@ seppy
8
8
  .. |python version| image:: https://img.shields.io/pypi/pyversions/seppy?style=flat&logo=python
9
9
  .. |zenodo doi| image:: https://zenodo.org/badge/451799504.svg
10
10
  :target: https://zenodo.org/badge/latestdoi/451799504
11
- .. |pytest| image:: https://github.com/serpentine-h2020/SEPpy/workflows/pytest/badge.svg
11
+ .. |pytest| image:: https://github.com/serpentine-h2020/SEPpy/actions/workflows/pytest.yml/badge.svg?branch=main
12
12
  .. |codecov| image:: https://codecov.io/gh/serpentine-h2020/SEPpy/branch/main/graph/badge.svg?token=FYELM4Y7DF
13
13
  :target: https://codecov.io/gh/serpentine-h2020/SEPpy
14
14
 
@@ -10,5 +10,6 @@ numpy
10
10
  pandas
11
11
  pooch
12
12
  requests
13
+ setuptools
13
14
  solo-epd-loader
14
15
  sunpy>=4.1.0
@@ -180,6 +180,9 @@ def wind3dp_download(dataset, startdate, enddate, path=None, **kwargs):
180
180
  if not os.path.exists(f):
181
181
  # downloaded_file = Fido.fetch(result[0][i], path=path, max_conn=max_conn)
182
182
  downloaded_file = wind3dp_single_download(files[i], path=path)
183
+ if downloaded_file == []:
184
+ print('Trying download from CDAWeb...')
185
+ downloaded_file = Fido.fetch(result[0][i], path=path) #, max_conn=max_conn)
183
186
 
184
187
  except (RuntimeError, IndexError):
185
188
  print(f'Unable to obtain "{dataset}" data for {startdate}-{enddate}!')
@@ -279,22 +282,31 @@ def wind3dp_load(dataset, startdate, enddate, resample="1min", multi_index=True,
279
282
  metacdf = cdflib.CDF(path_to_metafile)
280
283
 
281
284
  e_mean = df.filter(like='ENERGY_').mean()
282
- # ∼30% ΔE/E => ΔE = 0.3*E
283
285
  # from Table 3 of Wilson et al. 2021, https://doi.org/10.1029/2020RG000714
284
- delta_e = 0.3 * e_mean
286
+ # ∼30% ΔE/E => ΔE = 0.3*E
287
+ if dataset in ['WI_SFSP_3DP', 'WI_SFPD_3DP', 'WI_SOSP_3DP', 'WI_SOPD_3DP']:
288
+ delta_e = 0.3 * e_mean
289
+ # ∼20% ΔE/E => ΔE = 0.2*E
290
+ elif dataset in ['WI_ELSP_3DP', 'WI_ELPD_3DP', 'WI_EHSP_3DP', 'WI_EHPD_3DP']:
291
+ delta_e = 0.2 * e_mean
285
292
  e_low = e_mean - delta_e
286
293
  e_high = e_mean + delta_e
287
294
  energies = pd.concat([e_mean, delta_e, e_low, e_high], axis=1, keys=['mean_E', 'DE', 'lower_E', 'upper_E'])
288
295
  energies['Bins_Text']= np.around(e_low/1e3, 2).astype('string') +' - '+ np.around(e_high/1e3, 2).astype('string') + ' keV'
289
296
 
290
297
  meta = {'channels_dict_df': energies,
291
- 'APPROX_ENERGY_LABELS': metacdf.varget('APPROX_ENERGY_LABELS'),
292
298
  'ENERGY_UNITS': metacdf.varattsget('ENERGY')['UNITS'],
293
299
  'FLUX_UNITS': metacdf.varattsget('FLUX')['UNITS'],
294
300
  'FLUX_FILLVAL': metacdf.varattsget('FLUX')['FILLVAL'],
295
- 'FLUX_LABELS': metacdf.varget('FLUX_ENERGY_LABL'),
296
301
  }
297
302
 
303
+ # for SFSP, SOSP, SFPD, SFSP:
304
+ try:
305
+ meta['APPROX_ENERGY_LABELS'] = metacdf.varget('APPROX_ENERGY_LABELS')
306
+ meta['FLUX_LABELS'] = metacdf.varget('FLUX_ENERGY_LABL')
307
+ except:
308
+ pass
309
+
298
310
  # create multi-index data frame of flux
299
311
  if multi_index:
300
312
  if dataset == 'WI_SFPD_3DP' or dataset == 'WI_SOPD_3DP':
@@ -62,7 +62,7 @@ def test_onset_spectrum_tsa_SOLO_STEP_ions_new_data_online():
62
62
  assert flux.shape == (164,)
63
63
  assert len(onset_stats) == 6
64
64
  assert isinstance(onset_stats[5], pd._libs.tslibs.nattype.NaTType) # onset_stats[5].isoformat().split('.')[0] == '2021-10-28T16:07:30'
65
- assert ~onset_found
65
+ assert not onset_found
66
66
  assert peak_time.isoformat().split('.')[0] == '2022-01-09T01:32:31'
67
67
  assert fig.get_axes()[0].get_title() == 'SOLO/STEP 0.0061 - 0.0091 MeV protons\n5min averaging, viewing: PIXEL AVERAGED'
68
68
  # Pixel 8
@@ -71,7 +71,7 @@ def test_onset_spectrum_tsa_SOLO_STEP_ions_new_data_online():
71
71
  assert flux.shape == (164,)
72
72
  assert len(onset_stats) == 6
73
73
  assert isinstance(onset_stats[5], pd._libs.tslibs.nattype.NaTType) # onset_stats[5].isoformat().split('.')[0] == '2021-10-28T16:12:30'
74
- assert ~onset_found
74
+ assert not onset_found
75
75
  assert peak_time.isoformat().split('.')[0] == '2022-01-09T00:02:31'
76
76
  assert fig.get_axes()[0].get_title() == 'SOLO/STEP 0.0061 - 0.0091 MeV protons\n5min averaging, viewing: PIXEL 8'
77
77
 
@@ -101,7 +101,7 @@ def test_onset_spectrum_tsa_SOLO_HET_online():
101
101
  assert flux.shape == (73,)
102
102
  assert len(onset_stats) == 6
103
103
  assert isinstance(onset_stats[5], pd._libs.tslibs.nattype.NaTType) # onset_stats[5] == pd.Timestamp('2021-10-28 15:31:59.492059')
104
- assert ~onset_found
104
+ assert not onset_found
105
105
  assert peak_time.isoformat().split('.')[0] == '2022-11-08T17:58:09'
106
106
  assert fig.get_axes()[0].get_title() == 'SOLO/HET 7.3540 - 7.8900 MeV protons\n5min averaging, viewing: SUN'
107
107
  # viewing "north", combined channel, electrons
@@ -112,7 +112,7 @@ def test_onset_spectrum_tsa_SOLO_HET_online():
112
112
  assert flux.shape == (73,)
113
113
  assert len(onset_stats) == 6
114
114
  assert isinstance(onset_stats[5], pd._libs.tslibs.nattype.NaTType) # onset_stats[5] == pd.Timestamp('2021-10-28 15:31:59.492059')
115
- assert ~onset_found
115
+ assert not onset_found
116
116
  assert peak_time.isoformat().split('.')[0] == '2022-11-08T22:27:56'
117
117
  assert fig.get_axes()[0].get_title() == 'SOLO/HET 0.4533 - 18.8300 MeV electrons\n5min averaging, viewing: NORTH'
118
118
 
@@ -139,7 +139,7 @@ def test_onset_spectrum_tsa_SOLO_EPT_online():
139
139
  assert flux.shape == (288,)
140
140
  assert len(onset_stats) == 6
141
141
  assert isinstance(onset_stats[5], pd._libs.tslibs.nattype.NaTType) # onset_stats[5] == pd.Timestamp('2021-10-28 15:31:59.492059')
142
- assert ~onset_found
142
+ assert not onset_found
143
143
  assert peak_time.isoformat().split('.')[0] == '2022-06-06T01:02:31'
144
144
  assert fig.get_axes()[0].get_title() == 'SOLO/EPT 0.0608 - 0.0678 MeV protons\n5min averaging, viewing: SUN'
145
145
  # viewing "north", combined channel, electrons
@@ -150,7 +150,7 @@ def test_onset_spectrum_tsa_SOLO_EPT_online():
150
150
  assert flux.shape == (288,)
151
151
  assert len(onset_stats) == 6
152
152
  assert isinstance(onset_stats[5], pd._libs.tslibs.nattype.NaTType) # onset_stats[5] == pd.Timestamp('2021-10-28 15:31:59.492059')
153
- assert ~onset_found
153
+ assert not onset_found
154
154
  assert peak_time.isoformat().split('.')[0] == '2022-06-06T23:02:31'
155
155
  assert fig.get_axes()[0].get_title() == 'SOLO/EPT 0.0334 - 0.0439 MeV electrons\n5min averaging, viewing: NORTH'
156
156
 
@@ -533,6 +533,6 @@ def test_onset_Bepi_SIXS_offline():
533
533
  assert flux.shape == (161,)
534
534
  assert len(onset_stats) == 6
535
535
  assert isinstance(onset_stats[5], pd._libs.tslibs.nattype.NaTType)
536
- assert ~onset_found
537
- assert peak_time.isoformat().split('.')[0] == '2023-07-19T02:25:42'
536
+ assert not onset_found
537
+ assert peak_time.isoformat().split('.')[0] == '2023-07-19T02:25:30'
538
538
  assert fig.get_axes()[0].get_title() == 'BEPI/SIXS 106 keV electrons\n1min averaging, viewing: 1'
@@ -109,24 +109,13 @@ def bepicolombo_sixs_stack(path, date, side, pos_timestamp='center'):
109
109
  df.index = np.array(times)
110
110
  df = df.drop(columns=['TimeUTC'])
111
111
 
112
- # TODO: (as it's not really nicely done so far)
113
- # careful!
114
- # adjusting the position of the timestamp manually.
115
- # requires knowledge of the original time resolution and timestamp position!
116
- if type(date) is datetime.datetime:
117
- change_date = pd.Timestamp(2022, 8, 29)
118
- elif type(date) is datetime.date:
119
- change_date = pd.Timestamp(2022, 8, 29).date()
120
- if date < change_date:
121
- cadence = 8
122
- elif date >= change_date:
123
- cadence = 24
124
- #
125
- if pos_timestamp == 'center':
126
- df.index = df.index+pd.Timedelta(f'{cadence/2}s')
127
- # warnings.warn("Assuming cadence of 8s before 2022-08-29 and 24s after!")
128
- custom_warning("Assuming cadence of 8s before 2022-08-29 and 24s after!")
129
- elif pos_timestamp == 'start':
112
+ if pos_timestamp == 'start':
113
+ cadence1 = (df.index[1]-df.index[0]).seconds
114
+ cadence2 = (df.index[-1]-df.index[-2]).seconds
115
+ if cadence1 != cadence2:
116
+ custom_warning("Bepi/SIXS cadence is changing throughout the day; something is wrong!")
117
+ df.index = df.index-pd.Timedelta(f'{cadence1/2}s')
118
+ elif pos_timestamp == 'center':
130
119
  pass
131
120
  except FileNotFoundError:
132
121
  print(f'Unable to open {filename}')
@@ -5,4 +5,4 @@ try:
5
5
  from setuptools_scm import get_version
6
6
  __version__ = get_version(root='..', relative_to=__file__)
7
7
  except Exception:
8
- __version__ = '0.1.15'
8
+ __version__ = '0.1.17'
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: seppy
3
- Version: 0.1.15
3
+ Version: 0.1.17
4
4
  Summary: SEPpy
5
5
  Home-page: https://github.com/serpentine-h2020/SEPpy
6
6
  Author: Jan Gieseler
@@ -51,7 +51,7 @@ seppy
51
51
  .. |python version| image:: https://img.shields.io/pypi/pyversions/seppy?style=flat&logo=python
52
52
  .. |zenodo doi| image:: https://zenodo.org/badge/451799504.svg
53
53
  :target: https://zenodo.org/badge/latestdoi/451799504
54
- .. |pytest| image:: https://github.com/serpentine-h2020/SEPpy/workflows/pytest/badge.svg
54
+ .. |pytest| image:: https://github.com/serpentine-h2020/SEPpy/actions/workflows/pytest.yml/badge.svg?branch=main
55
55
  .. |codecov| image:: https://codecov.io/gh/serpentine-h2020/SEPpy/branch/main/graph/badge.svg?token=FYELM4Y7DF
56
56
  :target: https://codecov.io/gh/serpentine-h2020/SEPpy
57
57
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes