serpentine-h2020 / serpentine

Python tools and software developed by the SERPENTINE project for data downloading and performing of analysis and visualisation
https://serpentine-h2020.eu/tools/
BSD 3-Clause "New" or "Revised" License
18 stars 2 forks source link

Add calculation of inferred injection time to onset determination notebook #25

Open jgieseler opened 1 year ago

jgieseler commented 1 year ago

The corresponding function inf_inj_time is already included in seppy.tools. What's needed is to provide a full example in the onset determination notebook. For example, something like this at the end of the notebook (after determining the onset):

>>> from seppy.tools import inf_inj_time

>>> # geometric mean of selected energy channel in MeV or using Astropy units
>>> geom_mean = (0.2734 * 0.312)**0.5
>>> # assumed solar wind speed in km/s
>>> sw_assumed = 400
>>> # particle type, 'p'roton or 'e'lectron (derive from w.species_drop.value ?)
>>> particle = 'p'

>>> inj_time, distance = inf_inj_time(w.spacecraft_drop.value, onset.to_pydatetime(), particle, geom_mean, sw_assumed)
>>> onset.to_pydatetime(), inj_time
(datetime.datetime(2021, 10, 28, 15, 42, 30),
 datetime.datetime(2021, 10, 28, 15, 28, 21, 265800))
>>> distance
1.1002017 AU

The question is if we can easily obtain the variables particle and geom_mean from the input variables of the onset determination...

jgieseler commented 1 year ago

Outdated:

Update: With https://github.com/serpentine-h2020/SEPpy/pull/26, inf_inj_time will be moved from seppy.tools to seppy.tools.utils!

jgieseler commented 1 year ago

Update: With seppy 0.1.7, inf_inj_time has been moved, import it with from seppy.util import resample_df