Skip to content

202506 satellite health#180

Merged
plutonheaven merged 17 commits intojtec:mainfrom
eulaliesa:202506_Satellite_Health
Jun 27, 2025
Merged

202506 satellite health#180
plutonheaven merged 17 commits intojtec:mainfrom
eulaliesa:202506_Satellite_Health

Conversation

@eulaliesa
Copy link
Copy Markdown
Contributor

@eulaliesa eulaliesa commented Jun 17, 2025

This PR adds a column health_flag to prx output. It does so by choosing the correct data from parsed RINEX NAV files depending on the constellation of an observation.
A flag equal to 0 means that the satellite is usable. If different from 0, depending on the constellation, some signals may not be usable. The interpretation of non-zero values are left to the user of the prx file.
Tests have been included to validate the correct assignment of the health flag value. Also, the benefits of considering the satellite health status is demonstrated in a positioning solution computed with observations containing an unhealthy satellite (G27 on 2024-01-01)

@plutonheaven
Copy link
Copy Markdown
Collaborator

@eulaliesa, you should provide an overview of the pull request, rather than the details of the last commit. Here is an example:

This PR adds a column health_flag to prx output. It does so by choosing the correct data from parsed RINEX NAV files depending on the constellation of an observation.
A flag equal to 0 means that the satellite is usable. If different from 0, depending on the constellation, some signals may not be usable. The interpretation of non-zero values are left to the user of the prx file.
Tests have been included to validate the correct assignment of the health flag value. Also, the benefits of considering the satellite health status is demonstrated in a positioning solution computed with observations containing an unhealthy satellite (G27 on 2024-01-01)

@plutonheaven plutonheaven requested a review from jtec June 19, 2025 13:21
Comment thread src/prx/rinex_nav/test/test_evaluate.py Outdated
"I": (0, 3),
"S": (0, 63),
}
for const, hf in zip(query["constellation"], query["health_flag"]):
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

You could also try assigning the range to two new columns with something like

for constellation,(ub, lb) in health_valid_ranges.items():
    query.loc[query.constellation == constellation, "upper_bound"] = ub
    query.loc[query.constellation == constellation, "lower_bound"] = lb
assert (query["health_flag"] <= query["upper_bound"]).all()

Sorry for any syntax errors, I did not actually try to tun this :)
Again, replacing what effectively is a loop over rows by a small number of vectorized operations will give us a speedup here.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Could we use one of the existing test files here?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Oh wait I guess we need it because the existing files do not have unhealthy satellites?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Indeed, I chose this test file because the satellite G27 had an unhealthy flag. The test was made to check how the position error was influenced by an unhealthy satellite.


per_sat_eph_query = per_sat_eph_query.groupby("orbit_type").apply(evaluate_orbit)
per_sat_eph_query = per_sat_eph_query.reset_index(drop=True)
per_sat_eph_query["health_flag"] = extract_health_flag_from_query(per_sat_eph_query)
Copy link
Copy Markdown
Owner

@jtec jtec Jun 23, 2025

Choose a reason for hiding this comment

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

I recommend a shorter

query["health_flag"] = query["health"]
query.loc[query.constellation=="C", "health_flag"] =  query.loc[query.constellation=="C", "SatH1"] 

Vectorized pandas operations tend to be (much) faster than looping over rows :).

I'd then also remove test_extract_health_flag_from_query since extracting the correct health flag values is already tested by test_compute_health_flag.

@jtec
Copy link
Copy Markdown
Owner

jtec commented Jun 23, 2025

@eulaliesa I am not sure I understand "directly use RINEX OBS files instead of pre-processed .prx files for generating query data." in the PR description - the CSV file (what does ".prx files" refer to?) is generated in the very end, so the query is always generated from observation timestamps. What am I missing?

@eulaliesa
Copy link
Copy Markdown
Contributor Author

@jtec I modified evaluate.py and test_evaluate.py based on your comments. I deleted test_extract_health_flag_from_query and changed the function extract_health_flag_from_query to use vectorized pandas operations. As for my comment, I am sorry that wasn't clear and I missunderstood. The query is indeed generated from observation timestamps.

@jtec
Copy link
Copy Markdown
Owner

jtec commented Jun 25, 2025

@eulaliesa Thanks for addressing the comments :) I took the liberty to update the PR description with the wording suggested by @plutonheaven. We try to keep the PR descriptions as clear as possible, since they are typically what future developers will look at to better understand a particula commit. PR descriptions are versioned, so feel free to roll back the changes I made if you disagree :)

Did you have a chance to run

if __name__ == "__main__":
on master vs. on this branch as a quick check of how processing time is impacted?

Running those benchmarks automatically in CI has been on our list for a while but did not make it into the code yet.

@eulaliesa
Copy link
Copy Markdown
Contributor Author

@jtec I ran benchmark.py on both the master branch and the updated one. The new version was approximately 4.2 secondes faster. Let me know if you think some changes still need to be done. :)

…atellite_Health

# Conflicts:
#	src/prx/rinex_nav/test/test_evaluate.py
@plutonheaven plutonheaven linked an issue Jun 25, 2025 that may be closed by this pull request
Copy link
Copy Markdown
Owner

@jtec jtec left a comment

Choose a reason for hiding this comment

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

Awesome, let's merge!

@plutonheaven plutonheaven merged commit 77f397c into jtec:main Jun 27, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add satellite health flag

3 participants