-
Notifications
You must be signed in to change notification settings - Fork 5
57 normalization good #134
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
Merged
Merged
Changes from 48 commits
Commits
Show all changes
59 commits
Select commit
Hold shift + click to select a range
640be02
started signature for normalization. this refs #57
JeanBilheux dcfe0eb
Definition of the input parameters. Checking validity. Listing most d…
JeanBilheux be2beb9
Load files and unit tests. this refs #57
JeanBilheux 89237b3
Added dependency. Rebin code and started unit tests. this refs #57
JeanBilheux 2b54e6e
all unit tests for rebin. this refs #57
JeanBilheux 69c7610
crop code and unit test. this refs #57
JeanBilheux 4f04aeb
fixed unit tests and code. this refs #57
JeanBilheux d2a2a11
combine, code and tests. this refs #57
JeanBilheux 2527798
Added code to test normalization. this refs #57
JeanBilheux de09c1c
added needed packages. this refs #57
JeanBilheux 772d328
Merge remote-tracking branch 'origin/v2.0' into 57_normalization
JeanBilheux b12a06b
fixed a few bugs. Added logger. this refs #57
JeanBilheux 56e38f9
added dependency. working on retrieving proton charge and time spectr…
JeanBilheux 7077044
get proton charge unit tests. this refs #57
JeanBilheux 8bfeeaf
refactoring code to make it work with timepix. this refs #57
JeanBilheux 5921824
refactoring the way the data and metadata for each sample and ob are …
JeanBilheux 9ed1db6
shutter counts retrieved. this refs #57
JeanBilheux 8c18c2b
adding shutter values for each image. this refs #57
JeanBilheux 7853d8e
refactorization and improved log messages. this refs #57
JeanBilheux 1dd0c5e
Added dependency (tomopy). Implemented remove outliers. this refs #57
JeanBilheux a98d900
Refactoring and regrouping at the top the common methods, rebin, load…
JeanBilheux 9f1b5f6
combine obs working. this refs #57
JeanBilheux 30dd8d2
combine data. this refs #57
JeanBilheux 494f719
normalization. this refs #57
JeanBilheux 270443f
More refactoring and applying proton charge and shutter counts ahead …
JeanBilheux a115db9
normalization with code in main file. this refs #57
JeanBilheux d93e59a
added code and unit test to switch units from lambda to ev. this refs…
JeanBilheux d4d0527
Fixed unit tests. this refs #57
JeanBilheux d0ba92a
unit conversion. this refs #57
JeanBilheux c191083
unit tests and code to go from time to lambda working. this refs #57
JeanBilheux 085680a
code to convert time spectra into energy. this refs #57
JeanBilheux 12f6ad4
Fixed conversion to energy units. this refs #57
JeanBilheux c00cbdb
producing time spectra for LANL data set. this refs #57
JeanBilheux e87af4a
Roi takes x2 or width and y2 or height. Added unit tests. this refs #57
JeanBilheux 3e57284
full process works for ORNL data. this refs #57
JeanBilheux 4a8e834
Added default uncertainties for now. this refs #57
JeanBilheux 3b06e1d
forgot save. this refs #57
JeanBilheux 9c59d48
fixed pixi conflict. this refs #57
JeanBilheux d49ac76
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] bfa5a57
Updated pixi.lock file. this refs #57
JeanBilheux 6629d00
Merge branch 'v2.0' into 57_normalization_good
KedoKudo 3ee764c
fix import error
KedoKudo 72d40a5
adjust importing order
KedoKudo 421bf56
Update src/pleiades/utils/units.py
KedoKudo 96a30ce
Update src/pleiades/utils/units.py
KedoKudo bf3abf7
Update tests/unit/pleiades/utils/test_load.py
KedoKudo 4f04abc
Update src/pleiades/processing/normalization.py
KedoKudo 1f30714
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 9f46ec1
Improved doc of normalization. Make unit tests I wrote conform to the…
JeanBilheux 9e535d9
started moving from os to Pathlib. this refs #57
JeanBilheux 28bf3bc
fixed doc. this refs #57
JeanBilheux 7bdbf18
fixed doc with missing ev. this refs #57
JeanBilheux 344cab9
fixed format of files.py. this refs #57
JeanBilheux 58ecfb4
added doc. this refs #57
JeanBilheux a27e61d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] b899ac5
updated doc. this refs #57
JeanBilheux 4b84ef1
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] f9019d2
add missing import
KedoKudo f3dd139
update test to match code behavior
KedoKudo 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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,111 @@ | ||
| PROTON_CHARGE_UNCERTAINTY = 0.005 | ||
|
|
||
|
|
||
| class Roi: | ||
| def __init__(self, x1=0, y1=0, x2=None, y2=None, width=None, height=None): | ||
| """x1 and x2 are mandatory | ||
| y2 or height are mandatory | ||
| x2 or width are mandatory""" | ||
|
|
||
| if x1 < 0 or y1 < 0: | ||
| raise ValueError("ROI top left corner coordinates must be non-negative") | ||
|
|
||
| if x2 is not None and width is not None: | ||
| raise ValueError("ROI cannot have both x2 and width defined") | ||
|
|
||
| if y2 is not None and height is not None: | ||
| raise ValueError("ROI cannot have both y2 and height defined") | ||
|
|
||
| if x2 is not None: | ||
| if x2 < 0: | ||
| raise ValueError("ROI x2 must be non-negative") | ||
|
|
||
| if x2 < x1: | ||
| raise ValueError("ROI x2 must be greater than or equal to x1") | ||
|
|
||
| if width is not None: | ||
| raise ValueError("ROI cannot have both x2 and width defined") | ||
|
|
||
| else: | ||
| if width is None or width <= 0: | ||
| raise ValueError("ROI width must be positive when x2 is not defined") | ||
| x2 = x1 + width | ||
|
|
||
| if y2 is not None: | ||
| if y2 < 0: | ||
| raise ValueError("ROI y2 must be non-negative") | ||
|
|
||
| if y2 < y1: | ||
| raise ValueError("ROI y2 must be greater than or equal to y1") | ||
|
|
||
| if height is not None: | ||
| raise ValueError("ROI cannot have both y2 and height defined") | ||
|
|
||
| else: | ||
| if height is None or height <= 0: | ||
| raise ValueError("ROI height must be positive when y2 is not defined") | ||
| y2 = y1 + height | ||
|
|
||
| self.x1 = x1 | ||
| self.y1 = y1 | ||
| self.x2 = x2 | ||
| self.y2 = y2 | ||
|
|
||
| def get_roi(self): | ||
| return (self.x1, self.y1, self.x2, self.y2) | ||
|
|
||
| def set_roi(self, x1, y1, x2, y2): | ||
| if x1 < 0 or y1 < 0 or x2 < 0 or y2 < 0: | ||
| raise ValueError("ROI coordinates must be non-negative") | ||
|
|
||
| self.x1 = x1 | ||
| self.y1 = y1 | ||
| self.x2 = x2 | ||
| self.y2 = y2 | ||
|
|
||
| def __repr__(self): | ||
| return f"Roi(x1={self.x1}, y1={self.y1}, x2={self.x2}, y2={self.y2})" | ||
|
|
||
| def __str__(self): | ||
| return f"Roi: (x1={self.x1}, y1={self.y1}) to (x2={self.x2}, y2={self.y2})" | ||
|
|
||
|
|
||
| class DataType: | ||
| sample = "sample" | ||
| ob = "ob" | ||
| normalization = "normalization" | ||
|
|
||
|
|
||
| class MasterDictKeys: | ||
| data_type = "data_type" | ||
| list_folders = "list_folders" | ||
|
|
||
| obs_data_combined = "obs_data_combined" | ||
| sample_data = "sample_data" | ||
| uncertainties_obs_data_combined = "uncertainties_obs_data_combined" | ||
| uncertainties_sample_data = "uncertainties_sample_data" | ||
|
|
||
| frame_number = "frame_number" | ||
| proton_charge = "proton_charge" | ||
| matching_ob = "matching_ob" | ||
| list_images = "list_images" | ||
| data = "data" | ||
| nexus_path = "nexus_path" | ||
| data_path = "data_path" | ||
| shutter_counts = "shutter_counts" | ||
| list_spectra = "list_spectra" | ||
| list_shutters = "list_shutters" | ||
| ext = "ext" | ||
|
|
||
|
|
||
| class Facility: | ||
| ornl = "ornl" | ||
| lanl = "lanl" | ||
|
|
||
|
|
||
| class NormalizationStatus: | ||
| all_nexus_file_found = False | ||
| all_spectra_file_found = False | ||
| all_shutter_counts_file_found = False | ||
| all_proton_charge_value_found = False | ||
| all_list_shutter_values_for_each_image_found = False |
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.
Uh oh!
There was an error while loading. Please reload this page.