A step-by-step guide to using the package

Code
from datetime import timedelta
from space_analysis.utils.speasy import get_polars_ldf
from discontinuitypy.mission.wind import WindConfigBase, wi_mfi_h2_bgse
from discontinuitypy.config import SpeasyIDsConfig
from discontinuitypy.core.pipeline import ids_finder
from discontinuitypy.detection import detect_variance, detect_gradient
from speasy.core.requests_scheduling.request_dispatch import init_cdaweb
from rich import print

init_cdaweb()
2025-04-17 01:04:11,914 INFO worker.py:1852 -- Started a local Ray instance.
Code
timerange = ["2021-05-03", "2021-05-04"]
tau = timedelta(seconds=30)
Code
data = get_polars_ldf(wi_mfi_h2_bgse, 'cda', timerange)
data
naive plan: (run LazyFrame.explain(optimized=True) to see the optimized plan)

DF ["Bx (GSE)", "By (GSE)", "Bz (GSE)", "time"]; PROJECT */4 COLUMNS
Code
detect_kwargs = {"tau": tau}
ids_finder(data, detect_kwargs=detect_kwargs)
2025-04-17 01:04:21.289 | INFO     | discontinuitypy.detection.variance:_time_resolution:284 - Time resolution not provided. Using median time difference: 0:00:00.092000
shape: (179, 33)
time index_diff len std index_std index_fluctuation tstart tstop t_us t_ds fit.vars.amplitude fit.vars.sigma t.d_time d_star fit.vars.c fit.stat.rsquared fit.stat.chisqr e_max e_min b_mag b_n B.vec.before B.vec.after B.before B.after db_mag bn_over_b db_over_b db_over_b_max dB_lmn dB n_cross duration
datetime[μs] f32 u32 f32 f32 f32 datetime[ns] datetime[μs] datetime[ns] datetime[ns] f64 f64 datetime[ns] f64 f64 f64 f64 array[f64, 3] array[f64, 3] f64 f64 array[f64, 3] array[f64, 3] f64 f64 f64 f64 f64 f64 array[f64, 3] array[f32, 3] array[f32, 3] f64
2021-05-03 00:30:30 0.125344 326 0.6324 2.345717 1.298162 2021-05-03 00:30:15 2021-05-03 00:30:45 2021-05-03 00:30:24.214500 2021-05-03 00:30:38.658500 1.313736 1.476094 2021-05-03 00:30:31.730143750 0.222502 5.899874 0.959527 1.720184 [-0.673682, 0.228118, 0.702933] [0.45662, -0.619398, 0.638627] 9.71777 -0.532399 [5.675503, -7.288523, -0.505815] [7.440231, -6.891242, -0.574831] 9.251473 10.157593 0.90612 -0.054786 0.093244 0.105107 [-1.764728, -0.397281, 0.069016] [-1.451231, 0.146876, 1.072016] [0.443778, -0.582931, 0.680626] 2.952187
2021-05-03 00:34:30 0.208116 326 0.992148 2.785341 1.870381 2021-05-03 00:34:15 2021-05-03 00:34:45 2021-05-03 00:34:23.414500 2021-05-03 00:34:40.894500 -6.399736 10.928201 2021-05-03 00:34:28.188584937 -0.146404 2.703447 0.813905 22.113517 [-0.816711, -0.489084, 0.306235] [-0.356505, 0.844956, 0.39869] 9.750112 8.780858 [1.063321, 4.503835, 8.553044] [-2.962887, 3.783818, 8.589926] 9.724698 9.842907 0.118209 0.90059 0.012124 0.097433 [4.026208, 0.720017, -0.036882] [2.948395, 2.156157, -1.840676] [-0.690227, 0.48683, -0.535336] 21.856402
2021-05-03 00:39:45 0.552096 326 2.190388 5.495312 4.506598 2021-05-03 00:39:30 2021-05-03 00:40:00 2021-05-03 00:39:30.418500 2021-05-03 00:39:55.350500 7.663419 6.119841 2021-05-03 00:39:46.325366233 0.313056 -3.454013 0.859472 149.610972 [-0.616493, -0.671008, 0.411929] [-0.374727, 0.710174, 0.596014] 11.34035 10.858299 [-3.96967, 1.634972, 10.270441] [3.180627, 2.280433, 10.644845] 11.131638 11.341494 0.209856 0.957492 0.018505 0.059703 [-7.150297, -0.645461, -0.374404] [-4.101444, -4.669544, 3.613455] [0.796464, -0.288207, 0.531584] 12.239682
2021-05-03 00:47:00 0.201195 326 0.764962 2.750701 1.5489 2021-05-03 00:46:45 2021-05-03 00:47:15 2021-05-03 00:46:57.998500 2021-05-03 00:47:14.926500 5.029102 7.283012 2021-05-03 00:47:01.718772664 0.172631 -3.207533 0.775725 28.796488 [-0.133935, -0.662665, 0.736843] [-0.207329, 0.745825, 0.633057] 12.379368 12.345074 [-2.44925, 0.500105, 12.196149] [1.716912, -0.055365, 12.269262] 12.449698 12.388933 -0.060765 0.99723 0.004909 0.018874 [-4.166162, 0.555469, -0.073114] [-1.111435, -2.743999, 2.984289] [0.945615, -0.030835, 0.323822] 14.566024
2021-05-03 00:52:00 0.16337 326 1.164931 2.635435 1.224977 2021-05-03 00:51:45 2021-05-03 00:52:15 2021-05-03 00:51:58.654500 2021-05-03 00:52:02.610500 4.678598 1.62577 2021-05-03 00:51:57.634132043 0.719443 -3.327682 0.51473 13.152734 [-0.04194, -0.824513, 0.564287] [-0.40749, 0.529791, 0.743823] 12.286048 12.169542 [-2.23053, 1.317889, 12.163883] [0.953343, 1.483039, 12.156662] 12.436726 12.283839 -0.152887 0.990517 0.012444 0.016755 [-3.183873, -0.16515, 0.007221] [0.020068, -2.596148, 1.850402] [0.954578, 0.177797, 0.2391] 3.251541
2021-05-03 21:38:15 0.466696 326 0.887063 2.105667 1.89228 2021-05-03 21:38:00 2021-05-03 21:38:30 2021-05-03 21:38:00.422500 2021-05-03 21:38:11.186500 -2.154743 0.24579 2021-05-03 21:38:09.967445608 -2.191651 0.442164 0.768822 14.899145 [0.529513, 0.158648, 0.833334] [-0.847944, 0.070476, 0.52538] 4.760393 0.244507 [1.415677, 4.550132, 0.197072] [-2.019896, 4.405292, 0.257302] 4.769348 4.853121 0.083773 0.051363 0.017598 0.085579 [3.435573, 0.14484, -0.06023] [-1.866688, -0.683444, -2.806448] [-0.835162, 0.024889, 0.549441] 0.49158
2021-05-03 22:33:30 0.170299 326 0.545855 2.079463 1.260535 2021-05-03 22:33:15 2021-05-03 22:33:45 2021-05-03 22:33:24.750500 2021-05-03 22:33:34.686500 3.007647 4.367437 2021-05-03 22:33:28.737244709 0.172163 -1.739605 0.945921 1.342651 [-0.935646, -0.242792, 0.256161] [-0.227555, 0.96978, 0.088009] 4.718245 4.621572 [-0.863273, -0.828672, 4.613619] [0.79854, -0.775134, 4.605301] 4.766279 4.737858 -0.028421 0.979511 0.006024 0.033057 [-1.661812, -0.053538, 0.008318] [-1.538531, -0.41283, 0.476497] [0.255627, 0.149739, 0.955109] 8.734873
2021-05-03 22:50:45 0.32467 326 0.907223 2.209682 1.208073 2021-05-03 22:50:30 2021-05-03 22:51:00 2021-05-03 22:50:33.954500 2021-05-03 22:50:53.090500 -2.033493 0.71861 2021-05-03 22:50:39.467708542 -0.707439 1.189104 0.942473 8.871784 [0.994594, 0.003998, 0.103763] [-0.004575, 0.999975, 0.005323] 4.878452 4.786008 [1.533312, 0.102912, 4.677923] [-1.405933, -0.108674, 4.694377] 4.923881 4.901595 -0.022286 0.981051 0.004568 0.056296 [2.939245, 0.211586, -0.016454] [-2.94538, 0.00348, -0.094455] [-0.03206, -0.007056, 0.999461] 1.437221
2021-05-03 22:52:45 0.310895 326 0.797825 3.197615 1.347188 2021-05-03 22:52:30 2021-05-03 22:53:00 2021-05-03 22:52:36.590500 2021-05-03 22:52:46.066500 -2.489264 1.558848 2021-05-03 22:52:40.073351981 -0.399215 1.20793 0.949772 3.125454 [-0.556024, -0.026705, 0.830737] [-0.00975, 0.999624, 0.025609] 4.98287 4.878119 [0.997898, 0.097332, 4.806209] [-1.60364, 0.642614, 4.673415] 4.909676 4.982512 0.072836 0.978978 0.014617 0.048194 [2.601538, -0.545282, 0.132794] [1.901002, -0.066617, -1.861377] [-0.696347, 0.074434, -0.713835] 3.117696
2021-05-03 23:40:30 0.430462 326 0.926707 2.399418 1.270198 2021-05-03 23:40:15 2021-05-03 23:40:45 2021-05-03 23:40:15.766500 2021-05-03 23:40:40.054500 -3.733113 4.253045 2021-05-03 23:40:20.619949976 -0.219438 2.50897 0.962259 8.07653 [-0.720814, -0.370654, 0.585699] [0.667916, -0.597272, 0.444021] 5.361672 -3.937635 [1.93723, -3.361123, -3.659523] [-1.431731, -3.458094, -3.83487] 5.333115 5.358591 0.025476 -0.734404 0.004751 0.049321 [3.368961, 0.096971, 0.175347] [2.329242, 1.422418, -1.985299] [-0.596089, -0.129799, -0.792357] 8.506091
Code
class WindConfig(WindConfigBase, SpeasyIDsConfig):
    pass
    
config = WindConfig(
    timerange = timerange,
    detect_kwargs=detect_kwargs,
)
Code
result, path = config.produce_or_load()
2025-04-17 01:04:24.839 | INFO     | discontinuitypy.config:_get_mag_data:144 - Setting time resolution to 0:00:00.092000
File /home/runner/work/discontinuitypy/discontinuitypy/data/Wind_tr=20210503-20210504_detect_func=detect_variance_detect_kwargs=(tau=0:00:30,ts=0:00:00.092000)_method=fit.arrow does not exist. Producing it now...
2025-04-17 01:04:31.798 | INFO     | discontinuitypy.integration:update_events_with_temp_data:193 - Ion temperature data is not available.
2025-04-17 01:04:31.798 | INFO     | discontinuitypy.integration:update_events_with_temp_data:201 - Electron temperature data is not available.
Could not save file. Error: No such file or directory (os error 2): ...tect_func=detect_variance_detect_kwargs=(tau=0:00:30,ts=0:00:00.092000)_method=fit.arrow
File /home/runner/work/discontinuitypy/discontinuitypy/data/Wind_tr=20210503-20210504_updated_detect_func=detect_variance_detect_kwargs=(tau=0:00:30,ts=0:00:00.092000)_method=fit.arrow does not exist. Producing it now...
Could not save file. Error: No such file or directory (os error 2): ...tect_func=detect_variance_detect_kwargs=(tau=0:00:30,ts=0:00:00.092000)_method=fit.arrow

Inspecting the magnetic data…

Code
config.mag_meta.data[0].plot()