Skip to content

Conversation

@laspsandoval
Copy link
Contributor

@laspsandoval laspsandoval commented Jan 23, 2026

Change Summary

Overview

The SWAPI team would like to implement a geometric rolling mean starting after 1 minute has passed (first sweep) and using the previous sweep.

A reminder that each sweep is 12 seconds.

Updated Files

  • process_swapi.py
    • Implement a geometric rolling mean.

Testing

test_process_swapi.py

@laspsandoval laspsandoval self-assigned this Jan 23, 2026
@laspsandoval laspsandoval added Ins: SWAPI Related to the SWAPI instrument I-ALiRT labels Jan 23, 2026
@laspsandoval laspsandoval added this to the January 2026 milestone Jan 23, 2026
Laura Sandoval added 2 commits January 23, 2026 12:44
@laspsandoval laspsandoval requested review from bishwassth, ejzirn and hi1011 and removed request for hi1011 January 23, 2026 19:53
@hafarooki
Copy link

Is there any easy way we could test how it behaves in the presence of data gaps in the actual packets before it goes live?

@laspsandoval
Copy link
Contributor Author

laspsandoval commented Jan 26, 2026

Is there any easy way we could test how it behaves in the presence of data gaps in the actual packets before it goes live?

This should test a scenario in which there is a gap:
def test_geometric_gaps():

But I added a packet scenario just in case you still needed to see it (see test_process_spacecraft_packet).

Just know that the algorithm waits 1 minute to begin the rolling average. However, if there is a gap, then the algorithm is ok with that and just uses what is available within the past minute. So, for example I put in:

"iois_1_packets_2025_344_05_57_56"
"iois_1_packets_2025_344_05_59_58"

There is a 1 minute gap between these packets.

swapi_met_list
[503042285, 503042297, 503042309, 503042321, 503042405, 503042417, 503042429, 503042441]
np.diff(swapi_met_list)
array([12, 12, 12, 84, 12, 12, 12])

So in the second packet a single value will be used to find the geometric mean initially

met_arr[index_0:][valid]
array([503042405])

And then more values are added.

Copy link

@hafarooki hafarooki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some minor stuff now


avg_swapi_met, avg_density, avg_speed, avg_temperature = geometric_mean(
swapi_met_list[4::],
pseudo_speed_list[4::],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pseudo proton speed


swapi_met_list = [12, 24, 36, 48, 60]

pseudo_speed_list = [400, 420, 440, 460, np.nan]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pseudo proton speed

):
(
avg_swapi_met,
avg_proton_density,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inconsistent proton/pseudo naming here

pseudo_proton_temperature_list.append(pseudo_temperature)
swapi_met_list.append(mid_measurement)

# Begin averaging after 1 minute has passed (5 sweeps).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably worth making this comment a bit more descriptive

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

I-ALiRT Ins: SWAPI Related to the SWAPI instrument

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants