Skip to content

Conversation

@mlincett
Copy link
Contributor

@mlincett mlincett commented Sep 29, 2023

This PR cleans up a bit the plotting code, but does not yet address #22.

Important: .npz files were removed from skymap_scanner, hence the CI testing for npz reading was failing. I have removed such test altogether as I believe we are not going to support .npz anymore in the future.

@mlincett mlincett marked this pull request as draft September 29, 2023 13:21
@mlincett mlincett marked this pull request as ready for review October 9, 2023 14:22
@mlincett mlincett changed the title Plotting functions updates Plotting functions cleanup Oct 9, 2023

# Output contours in RA, dec instead of theta, phi
saving_contours = []
saving_contours: list = []
Copy link
Member

Choose a reason for hiding this comment

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

This isn't needed unless you subscript a sub-type

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think mypy was complaining here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

skyreader/result.py:1097: error: Need type annotation for "saving_contours" (hint: "saving_contours: List[<type>] = ...")  [var-annotated]

Copy link
Member

Choose a reason for hiding this comment

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

odd... but okay if mypy says so!

extra_header = fits_header, overwrite=True)
# Dump the whole contour
path = unique_id + ".contour.pkl"
print("Saving contour to", path)
Copy link
Member

Choose a reason for hiding this comment

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

You have several prints. Generally, I recommend avoiding this pattern for anything other than scripts (I see this package as a library) and using logs instead. What's the intended use of these plotting functions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I don't like it either, it is a pattern inherited from the old code. Surely we can implement proper loggers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would say this is a todo for a future PR.

Copy link
Member

Choose a reason for hiding this comment

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

sure, can you make an issue for it?

Copy link
Member

@ric-evans ric-evans left a comment

Choose a reason for hiding this comment

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

A few comments for you.

The rest looks more up @tianluyuan's wheelhouse

Copy link
Contributor

@tianluyuan tianluyuan left a comment

Choose a reason for hiding this comment

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

Looks good! I added a few comments.

I was the one who removed the npz test files from skymap-scanner, as I didn't see it being used in any of its tests. I didn't realize they were still used here but it's ok as long as we keep npz support for a bit longer, i have some older scans that only exists in that format.

@mlincett
Copy link
Contributor Author

Looks good! I added a few comments.

I was the one who removed the npz test files from skymap-scanner, as I didn't see it being used in any of its tests. I didn't realize they were still used here but it's ok as long as we keep npz support for a bit longer, i have some older scans that only exists in that format.

I added the npz test exactly for the purpose of the CI testing of the Skymap Scanner (we did not want the CI testing of the scanner failing because of SkyReader not reading npz), so no big deal indeed.

@mlincett
Copy link
Contributor Author

I have added some minor modifications for partial compliance with mypy and put remaining errors as comment.

Some of mypy complaints appear like they should raise runtime errors, but they don't. Maybe it's just matplotlib being still a bit of a mess, but it's good to keep an eye on those when we refactor the code.

@ric-evans
Copy link
Member

Looks good! I added a few comments.
I was the one who removed the npz test files from skymap-scanner, as I didn't see it being used in any of its tests. I didn't realize they were still used here but it's ok as long as we keep npz support for a bit longer, i have some older scans that only exists in that format.

I added the npz test exactly for the purpose of the CI testing of the Skymap Scanner (we did not want the CI testing of the scanner failing because of SkyReader not reading npz), so no big deal indeed.

@mlincett @tianluyuan how about we add a separate script to convert npz to json? that way, we can remove npz support without abandoning the old format entirely

@tianluyuan
Copy link
Contributor

Looks good! I added a few comments.
I was the one who removed the npz test files from skymap-scanner, as I didn't see it being used in any of its tests. I didn't realize they were still used here but it's ok as long as we keep npz support for a bit longer, i have some older scans that only exists in that format.

I added the npz test exactly for the purpose of the CI testing of the Skymap Scanner (we did not want the CI testing of the scanner failing because of SkyReader not reading npz), so no big deal indeed.

@mlincett @tianluyuan how about we add a separate script to convert npz to json? that way, we can remove npz support without abandoning the old format entirely

yea that could work as a fail-safe for older scans and I would be fine with removing the npz support once the script is available.

@mlincett mlincett merged commit 97dff8e into main Oct 12, 2023
@ric-evans ric-evans deleted the plotting-updates branch October 13, 2023 15:49
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.

5 participants