-
Notifications
You must be signed in to change notification settings - Fork 4
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
BP Map recipe template and test #168
Conversation
…map and figure out KGAIN
…changes with 12-to-l2 e2e
Automated code checks are failing because it can't find the TVAC FITS files I use locally to run the test_bp_map.py e2e test. |
You should add the |
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.
I have a few comments to simplify your implementation a bit. Also, have you tried running this code on the TVAC data from the Box folder? We want to make sure all the tests will run using just the files available there.
Also, it looks like you changed quite a few files that are out of scope of the BPMap recipe template and test. I would recommend not adding these to PRs in the future, since it just complicates the PR. If there are issues with other lines of code, please make a separate PR and issue about it.
tests/e2e_tests/test_bp_map.py
Outdated
bp_map_outputdir = os.path.join(e2eoutput_path, "bp_map_output") | ||
if not os.path.exists(bp_map_outputdir): | ||
os.mkdir(bp_map_outputdir) | ||
dark_current_filename = "dark_current_20240322.fits" |
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.
all these filenames should match the filenames on Box.
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.
Echoing an above comment - there are issues with the files on Box. Once Marie is able to fix them I will update the names
Merged main into julia_bp_map and resolved conflicts.
get_calib can take None as input
Merged changes that allow get_calib to take None as input. Addressed other comments above and separated tests into two different files (can put both functions in one file, whatever your preference is). |
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.
Looks good. Thanks for promptly addressing those comments! I would prefer both tests in the same file, so if you can do that move, that'd be great.
There's also a tiny merge conflict in caldb.py that I think should be trivial (just keep the changes in main, since the change in indentation is intentional). It looks like this branch's version has a different line ending setting.
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.
Actually, sorry, I just tried running the tests, and the filepaths don't quite work with the Box data as the filenames aren't the same.
Marie was going to update the noise map calibration files on Box, let me check with her on status of that. |
That's right, yesterday afternoon didn't go as planned but I'm working on it right now. Thanks for your patience. |
One final item to note is that build_synthesized_dark takes in a dataset and looks for KGAIN in the headers. Since I am just using a dummy dataset of L1 frames for now (because BP map doesn't require any real input frames), I just set the KGAIN to a value since that parameter is not found in the header of L1 frames. In the future, however, will this mean that the frames need to be processed before passing them to build_synthesized_dark? |
Merge 'main' into 'julia_bp_map' to update with latest changes
Yes, I guess this is true, that the input dataset must have already gone through the |
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.
Ok, just a couple remaining small things, so that the tests can be picked out correctly when I run pytest in e2e mode.
tests/e2e_tests/bp_map_e2e.py
Outdated
thisfile_dir = os.path.dirname(__file__) | ||
|
||
@pytest.mark.e2e | ||
def bp_map_master_dark_e2e(tvacdata_path, e2eoutput_path): |
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.
One last thing: based on how conftest.py collects tests for automated testing, the two tests here don't get identified unless the functions start with test_*
. We just need to prepend "test_" to each function name.
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.
done
tests/e2e_tests/bp_map_e2e.py
Outdated
output_path = os.path.join(bp_map_outputdir, "bp_map_master_dark_test.png") | ||
plt.savefig(output_path) | ||
|
||
def bp_map_simulated_dark_e2e(tvacdata_path, e2eoutput_path): |
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.
In addition to preprending "test_", we also need the @pytest.mark.e2e
decorator.
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.
done
Describe your changes
Type of change
New feature
Reference any relevant issues (don't forget the #)
Create recipe template for generating a BadPixelMap Calibration #149
Checklist before requesting a review
Linter output: (No data and header member outputs are false positives)
************* Module test_bp_map
tests/e2e_tests/test_bp_map.py:1:0: C0114: Missing module docstring (missing-module-docstring)
tests/e2e_tests/test_bp_map.py:15:0: R0914: Too many local variables (61/15) (too-many-locals)
tests/e2e_tests/test_bp_map.py:54:22: E1101: Instance of 'HDUList' has no 'header' member (no-member)
tests/e2e_tests/test_bp_map.py:56:22: E1101: Instance of 'HDUList' has no 'header' member (no-member)
tests/e2e_tests/test_bp_map.py:72:18: E1101: Instance of 'HDUList' has no 'data' member; maybe '_data'? (no-member)
tests/e2e_tests/test_bp_map.py:74:18: E1101: Instance of 'HDUList' has no 'data' member; maybe '_data'? (no-member)
tests/e2e_tests/test_bp_map.py:76:27: E1101: Instance of 'HDUList' has no 'data' member; maybe '_data'? (no-member)
tests/e2e_tests/test_bp_map.py:97:19: E1101: Instance of 'HDUList' has no 'data' member; maybe '_data'? (no-member)
tests/e2e_tests/test_bp_map.py:102:17: E1101: Instance of 'HDUList' has no 'header' member (no-member)
tests/e2e_tests/test_bp_map.py:103:17: E1101: Instance of 'HDUList' has no 'header' member (no-member)
tests/e2e_tests/test_bp_map.py:152:27: E1101: Instance of 'HDUList' has no 'data' member; maybe '_data'? (no-member)
tests/e2e_tests/test_bp_map.py:206:27: E1101: Instance of 'HDUList' has no 'data' member; maybe '_data'? (no-member)
tests/e2e_tests/test_bp_map.py:15:0: R0915: Too many statements (137/50) (too-many-statements)
Your code has been rated at 6.65/10 (previous run: 6.58/10, +0.06)