-
Notifications
You must be signed in to change notification settings - Fork 76
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
Units cleanup #3204
Merged
Merged
Units cleanup #3204
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
127d295
defined pix2 unit
cshanahan1 b8d5a82
define supported units in one place
cshanahan1 5945959
code style
cshanahan1 c805453
new test file
cshanahan1 3250230
added test
cshanahan1 f781b6f
Merge branch 'main' into units_cleanup
cshanahan1 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
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
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.
is there a reason not to include
ct
(perhaps optionally) in the function?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 wanted to keep it clear that 'locally_defined_flux_units' are units that can be converted to and from one another, and counts can not.
(This is a tangent but I wanted to write down my thoughts before I forget):- locally_defined_flux_units is the list of units that appears in the dropdown if your loaded data is compatible with one of the units in that list. A more descriptive name might make sense, especially to make it clear that this list of units is the available conversions for data loaded in a compatible unit, and is not relevant otherwise.
If your loaded data is in counts, and you wanted to be able to convert from counts to e/s (not sure if this actually makes sense, just an example), then there would be another list of 'flux units' that is ['counts', 'e/s'] etc.
Eventually we could use these lists of units we support and support conversions between to check the input against and raise warnings if you load a nonsense unit. We could also do away with the 'create_flux_equivalencies_list` function and just check if the input unit is compatible with one of these 'locally_defined_flux_units' lists, and append the input unit as a choice if it is (and if not, there will be no other choices for flux conversion so this will avoid the issue where it provides those units and the conversion breaks)
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, thanks for the explanation. The flux choices in unit conversion is still populated by
create_flux_equivalencies_list
- should that be changed here/now or not?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.
Its going to require a little more thought and writing some more tests to make sure different loaded units get the correct unit choices, so maybe not in this PR
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.
Sounds good - deal!