-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add analysis functions for M&E results #13
Open
ntellis
wants to merge
8
commits into
main
Choose a base branch
from
nt/me_analysis
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
de0882f
First pass at analysis functions for ME results
ntellis 955ad49
Merge branch 'main' into nt/me_analysis
ntellis d03332b
WIP on me analysis with quivr
ntellis 414454b
rewrite analysis to use attribution information in expected_members
ntellis 17064d0
appease mypy, add explicit orbit IDs for initial, result members
ntellis 458b6db
Add a test for me analysis
ntellis bb2f88e
add summary analysis functions
ntellis 52d9f54
bump precovery version
ntellis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
from thor.orbit_determination.fitted_orbits import FittedOrbitMembers | ||
|
||
from ipod.utils import ExpectedMembers, analyze_me_output | ||
|
||
|
||
def test_me_analysis(): | ||
|
||
# Initialize the expected members | ||
data_expected = { | ||
"orbit_id": ["orbit1", "orbit1", "orbit2", "orbit2"], | ||
"obs_id": ["obs1", "obs2", "obs3", "obs4"], | ||
"primary_designation": [ | ||
"designation1", | ||
"designation1", | ||
"designation2", | ||
"designation2", | ||
], | ||
} | ||
|
||
expected_members = ExpectedMembers.from_kwargs( | ||
orbit_id=data_expected["orbit_id"], | ||
obs_id=data_expected["obs_id"], | ||
primary_designation=data_expected["primary_designation"], | ||
) | ||
|
||
# Initialize the initial members | ||
data_initial = { | ||
"orbit_id": ["orbit1", "orbit2", "orbit2"], | ||
"obs_id": ["obs1", "obs3", "obs4"], | ||
} | ||
initial_members = FittedOrbitMembers.from_kwargs( | ||
orbit_id=data_initial["orbit_id"], obs_id=data_initial["obs_id"] | ||
) | ||
|
||
# Initialize the ME output members | ||
data_me = { | ||
"orbit_id": ["orbit1", "orbit1", "orbit3"], | ||
"obs_id": ["obs1", "obs2", "obs5"], | ||
} | ||
me_members = FittedOrbitMembers.from_kwargs( | ||
orbit_id=data_me["orbit_id"], obs_id=data_me["obs_id"] | ||
) | ||
|
||
# Call the function with the test data | ||
result = analyze_me_output(expected_members, initial_members, me_members) | ||
|
||
# Check the results using asserts | ||
assert result.loc["designation1", "num_missing_obs"] == 0 | ||
assert result.loc["designation1", "num_extra_obs"] == 0 | ||
assert result.loc["designation1", "num_bogus_obs"] == 0 | ||
assert result.loc["designation1", "num_initial_orbits_with_attributed_members"] == 1 | ||
assert result.loc["designation1", "num_result_orbits_with_attributed_members"] == 1 | ||
assert result.loc["designation1", "best_result_orbit_id"] == "orbit1" | ||
assert result.loc["designation1", "initial_orbits_with_attributed_members"] == [ | ||
"orbit1" | ||
] | ||
assert result.loc["designation1", "result_orbits_with_attributed_members"] == [ | ||
"orbit1", | ||
] | ||
|
||
assert result.loc["designation2", "num_missing_obs"] == 2 | ||
assert result.loc["designation2", "num_extra_obs"] == 0 | ||
assert result.loc["designation2", "num_bogus_obs"] == 0 | ||
assert result.loc["designation2", "num_initial_orbits_with_attributed_members"] == 1 | ||
assert result.loc["designation2", "num_result_orbits_with_attributed_members"] == 0 | ||
assert result.loc["designation2", "best_result_orbit_id"] == "None" | ||
assert result.loc["designation2", "initial_orbits_with_attributed_members"] == [ | ||
"orbit2" | ||
] | ||
assert result.loc["designation2", "result_orbits_with_attributed_members"] == [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How are orbits with overlapping observations handled?