Skip to content
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

Unit tests #226

Open
3 of 6 tasks
israelmcmc opened this issue Jul 22, 2024 · 5 comments
Open
3 of 6 tasks

Unit tests #226

israelmcmc opened this issue Jul 22, 2024 · 5 comments

Comments

@israelmcmc
Copy link
Collaborator

israelmcmc commented Jul 22, 2024

Umbrella issue to keep track of the unit test coverage progress. While the eventual goal is to have 100% coverage, for now I'll check each module when it reaches 80%.

See details here: https://app.codecov.io/gh/cositools/cosipy/tree/develop/cosipy

@israelmcmc
Copy link
Collaborator Author

Updated progress after PR #231

@augustus-thomas
Copy link

Hello @israelmcmc! I would like to write some unit tests to help this project get better coverage.
Are there any tests that I can be assigned? I see that there are a few PR's open that are untested.

@israelmcmc
Copy link
Collaborator Author

Thanks @augustus-thomas! How about you add some tests for the response module to increase its coverage?

The tests are here:
https://github.com/cositools/cosipy/tree/develop/tests/response

You can see the lines that are not covered here:
https://app.codecov.io/github/cositools/cosipy/tree/develop/cosipy%2Fresponse

Let me know if you need more info to get you started :)

@augustus-thomas
Copy link

augustus-thomas commented Sep 6, 2024

Hi @israelmcmc thank you so much. I am very excited to finally start helping out!

It looks like a large number of the uncovered lines in FullDetectorResponse.py are due to the untested method _open_rsp() This requires an rsp.gz file in the test data folder, which we do not currently have. Do you know of a good endpoint I can fetch with fetch_wasabi? I am unfamiliar with generating or fetching a file like that, and we would need to push it to the test_data directory to get more coverage!

Also, is there a way to browse the cosipy data that can be fetched with wasabi? That way I would not need to ask this type of question in the future

@israelmcmc
Copy link
Collaborator Author

@augustus-thomas You can use the following command to browse wasabi (with your cosipy environment loaded):

AWS_ACCESS_KEY_ID=GBAL6XATQZNRV3GFH9Y4 AWS_SECRET_ACCESS_KEY=GToOczY5hGX3sketNO2fUwiq4DJoewzIgvTCHoOv  aws s3 ls "s3://cosi-pipeline-public/COSI-SMEX/DC2" --recursive --endpoint-url=https://s3.us-west-1.wasabisys.com/

There's no equivalent cosipy function, but you could add one in PR. fetch_wasabi_file is a wrapper around a similar command like the above.

There are a few .rsp files in there. You can use them to see how's the format internally (it's just a histogram of simulated counts) but please create a light fake one for the unit tests. You don't have to run the simulation from scratch, you can create it by "hand", maybe something similar to this test file:
https://github.com/cositools/cosipy/blob/develop/cosipy/test_data/test_full_detector_response.h5

You can see that is very coarse and it can't be use for science, but the unit tests only check that the algorithm itself works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress - Active
Development

No branches or pull requests

6 participants