seppy 0.1.15__py3-none-any.whl → 0.1.17__py3-none-any.whl

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.

seppy/loader/wind.py CHANGED
@@ -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':
seppy/tests/test_tools.py CHANGED
@@ -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'
seppy/util/__init__.py CHANGED
@@ -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}')
seppy/version.py CHANGED
@@ -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
@@ -33,13 +33,13 @@ Requires-Dist: requests
33
33
  Requires-Dist: solo-epd-loader
34
34
  Requires-Dist: sunpy>=4.1.0
35
35
  Provides-Extra: all
36
- Provides-Extra: docs
37
- Requires-Dist: sphinx; extra == "docs"
38
- Requires-Dist: sphinx-automodapi; extra == "docs"
39
36
  Provides-Extra: test
40
37
  Requires-Dist: pytest; extra == "test"
41
38
  Requires-Dist: pytest-doctestplus; extra == "test"
42
39
  Requires-Dist: pytest-cov; extra == "test"
40
+ Provides-Extra: docs
41
+ Requires-Dist: sphinx; extra == "docs"
42
+ Requires-Dist: sphinx-automodapi; extra == "docs"
43
43
 
44
44
  seppy
45
45
  =====
@@ -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
 
@@ -1,5 +1,5 @@
1
1
  seppy/__init__.py,sha256=M8ZBbGj0r_XdNVLzaSXF38M4wyzAgUX32LXcSYh5O5A,254
2
- seppy/version.py,sha256=86lr4VUTfCM5Saeoz0h6DkiA3FNlIbon3BsAepb63G0,346
2
+ seppy/version.py,sha256=ZfyBAus4lEppBW04TYAwcehqpK2ZB149Kdo9PHYeWVg,346
3
3
  seppy/data/test/20230719_side0.csv,sha256=0htTQcdQydRc92bkO26lxK8tDRSeN6uov13VfsqmUFQ,72368
4
4
  seppy/data/test/20230719_side1.csv,sha256=iHCfHmOIltJatncWpns_zq3ym_-2yRu0twmDvQDbmJw,72368
5
5
  seppy/data/test/20230719_side2.csv,sha256=eYyEQX5fNDO4E57KwKN3bHs6u5-lHaAhIHt-3f20Urg,72368
@@ -14,16 +14,16 @@ seppy/loader/psp.py,sha256=PbxCEW-06d2I_JGIfIAqqXMU_uPdQFhmh-fUoXpzz9k,31535
14
14
  seppy/loader/soho.py,sha256=EIFKde1dGpT9yU6bU-XtTsHUCvTEkzHhdPOOMtqVrDU,20262
15
15
  seppy/loader/solo.py,sha256=Nst2ZJU2yH5NHsB6M_69ryVfzt978hbmqhxaHZJREVg,3054
16
16
  seppy/loader/stereo.py,sha256=S0_IRIFbFxLH00bSIt1uZMflmuG5dAU5sKw0w9NL9oM,24583
17
- seppy/loader/wind.py,sha256=3rWV_EOcY7sY69eqtCQCZxL5GxAQZuMm1-wpJJxrej8,18460
17
+ seppy/loader/wind.py,sha256=44zqFJsNn2fyLDi5SLkqTQO5iGCdVk5a8p7s28VVw6Y,18995
18
18
  seppy/tests/__init__.py,sha256=1D-l3TVbwIZHY78A-sB7kc4ldldX8ZaEq-Ntph51WVw,108
19
19
  seppy/tests/test_loader.py,sha256=mt52vrAeSEtJ-od4Cqt0HrscN_ykKNHklGZm8OTZjLs,7767
20
- seppy/tests/test_tools.py,sha256=NrKXrlgCsy9RRx2V7fUGRtB1l8N0_CXasyGjoB_lSNU,31518
20
+ seppy/tests/test_tools.py,sha256=LQPekw-ddse88OYu-LWChFcJPT2SwGS7uEG1tKRLVok,31539
21
21
  seppy/tools/__init__.py,sha256=Ge3lQ9zVRJ27aaHSet2I1wQ9tD4emVfjnn49pUGcoiY,116086
22
22
  seppy/tools/swaves.py,sha256=OcohPXLko0ik9FLyYMVkYxI75W4XzOKvQ2Ylnwi-wlQ,3139
23
23
  seppy/tools/widgets.py,sha256=atQj9vvus0UgrUV6vlPcTdjpaidnERUevOp6FUmGLSI,6820
24
- seppy/util/__init__.py,sha256=0J3DNmOdh9X8a-uZy0yfFe1ubFSfcF5b7K4RMSJvGHA,15705
25
- seppy-0.1.15.dist-info/LICENSE.rst,sha256=SxptLPCIHKdfDjyguGdC7ai6Eze-Vz_t1jdqC8h19js,1473
26
- seppy-0.1.15.dist-info/METADATA,sha256=Q4NN8Ku265gLCQGT1Ys81X1Uml6Hlk2Q2jwY5_tEdqw,4374
27
- seppy-0.1.15.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
28
- seppy-0.1.15.dist-info/top_level.txt,sha256=G2Op1GREPmbCX81isNhYY_7ZZyLWLIm-MJC04J4Fgc4,6
29
- seppy-0.1.15.dist-info/RECORD,,
24
+ seppy/util/__init__.py,sha256=RMMeH37L75wwQPHb_-_-2Rk7lzlDtBC2K6lkWKtxAMg,15253
25
+ seppy-0.1.17.dist-info/LICENSE.rst,sha256=SxptLPCIHKdfDjyguGdC7ai6Eze-Vz_t1jdqC8h19js,1473
26
+ seppy-0.1.17.dist-info/METADATA,sha256=zEKt2cdJMiv7iEUN_cuk8K24xvPOlHsirjA0n70h1ns,4398
27
+ seppy-0.1.17.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
28
+ seppy-0.1.17.dist-info/top_level.txt,sha256=G2Op1GREPmbCX81isNhYY_7ZZyLWLIm-MJC04J4Fgc4,6
29
+ seppy-0.1.17.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (72.2.0)
2
+ Generator: setuptools (75.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5