Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 Apr 25, 2025
dcfe0eb
Definition of the input parameters. Checking validity. Listing most d…
JeanBilheux May 1, 2025
be2beb9
Load files and unit tests. this refs #57
JeanBilheux May 2, 2025
89237b3
Added dependency. Rebin code and started unit tests. this refs #57
JeanBilheux May 6, 2025
2b54e6e
all unit tests for rebin. this refs #57
JeanBilheux May 6, 2025
69c7610
crop code and unit test. this refs #57
JeanBilheux May 6, 2025
4f04aeb
fixed unit tests and code. this refs #57
JeanBilheux May 6, 2025
d2a2a11
combine, code and tests. this refs #57
JeanBilheux May 6, 2025
2527798
Added code to test normalization. this refs #57
JeanBilheux May 6, 2025
de09c1c
added needed packages. this refs #57
JeanBilheux May 6, 2025
772d328
Merge remote-tracking branch 'origin/v2.0' into 57_normalization
JeanBilheux May 6, 2025
b12a06b
fixed a few bugs. Added logger. this refs #57
JeanBilheux May 6, 2025
56e38f9
added dependency. working on retrieving proton charge and time spectr…
JeanBilheux May 6, 2025
7077044
get proton charge unit tests. this refs #57
JeanBilheux May 6, 2025
8bfeeaf
refactoring code to make it work with timepix. this refs #57
JeanBilheux May 6, 2025
5921824
refactoring the way the data and metadata for each sample and ob are …
JeanBilheux May 7, 2025
9ed1db6
shutter counts retrieved. this refs #57
JeanBilheux May 7, 2025
8c18c2b
adding shutter values for each image. this refs #57
JeanBilheux May 7, 2025
7853d8e
refactorization and improved log messages. this refs #57
JeanBilheux May 8, 2025
1dd0c5e
Added dependency (tomopy). Implemented remove outliers. this refs #57
JeanBilheux May 8, 2025
a98d900
Refactoring and regrouping at the top the common methods, rebin, load…
JeanBilheux May 8, 2025
9f1b5f6
combine obs working. this refs #57
JeanBilheux May 9, 2025
30dd8d2
combine data. this refs #57
JeanBilheux May 9, 2025
494f719
normalization. this refs #57
JeanBilheux May 9, 2025
270443f
More refactoring and applying proton charge and shutter counts ahead …
JeanBilheux May 9, 2025
a115db9
normalization with code in main file. this refs #57
JeanBilheux May 9, 2025
d93e59a
added code and unit test to switch units from lambda to ev. this refs…
JeanBilheux May 9, 2025
d4d0527
Fixed unit tests. this refs #57
JeanBilheux May 9, 2025
d0ba92a
unit conversion. this refs #57
JeanBilheux May 12, 2025
c191083
unit tests and code to go from time to lambda working. this refs #57
JeanBilheux May 12, 2025
085680a
code to convert time spectra into energy. this refs #57
JeanBilheux May 12, 2025
12f6ad4
Fixed conversion to energy units. this refs #57
JeanBilheux May 27, 2025
c00cbdb
producing time spectra for LANL data set. this refs #57
JeanBilheux Jul 25, 2025
e87af4a
Roi takes x2 or width and y2 or height. Added unit tests. this refs #57
JeanBilheux Jul 25, 2025
3e57284
full process works for ORNL data. this refs #57
JeanBilheux Jul 28, 2025
4a8e834
Added default uncertainties for now. this refs #57
JeanBilheux Jul 29, 2025
3b06e1d
forgot save. this refs #57
JeanBilheux Jul 29, 2025
9c59d48
fixed pixi conflict. this refs #57
JeanBilheux Jul 29, 2025
d49ac76
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 29, 2025
bfa5a57
Updated pixi.lock file. this refs #57
JeanBilheux Jul 29, 2025
6629d00
Merge branch 'v2.0' into 57_normalization_good
KedoKudo Jul 31, 2025
3ee764c
fix import error
KedoKudo Jul 31, 2025
72d40a5
adjust importing order
KedoKudo Jul 31, 2025
421bf56
Update src/pleiades/utils/units.py
KedoKudo Jul 31, 2025
96a30ce
Update src/pleiades/utils/units.py
KedoKudo Jul 31, 2025
bf3abf7
Update tests/unit/pleiades/utils/test_load.py
KedoKudo Jul 31, 2025
4f04abc
Update src/pleiades/processing/normalization.py
KedoKudo Jul 31, 2025
1f30714
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 31, 2025
9f46ec1
Improved doc of normalization. Make unit tests I wrote conform to the…
JeanBilheux Aug 4, 2025
9e535d9
started moving from os to Pathlib. this refs #57
JeanBilheux Aug 4, 2025
28bf3bc
fixed doc. this refs #57
JeanBilheux Aug 4, 2025
7bdbf18
fixed doc with missing ev. this refs #57
JeanBilheux Aug 4, 2025
344cab9
fixed format of files.py. this refs #57
JeanBilheux Aug 4, 2025
58ecfb4
added doc. this refs #57
JeanBilheux Aug 4, 2025
a27e61d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 4, 2025
b899ac5
updated doc. this refs #57
JeanBilheux Aug 4, 2025
4b84ef1
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 4, 2025
f9019d2
add missing import
KedoKudo Aug 7, 2025
f3dd139
update test to match code behavior
KedoKudo Aug 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7,292 changes: 4,572 additions & 2,720 deletions pixi.lock

Large diffs are not rendered by default.

19 changes: 18 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,21 @@ authors = [
{name = "Chen Zhang", email = "zhangc@ornl.gov"},
{name = "Jean Bilheux", email = "bilheuxjm@ornl.gov"},
]
dependencies = [ "numpy", "scipy", "pandas", "matplotlib", "jupyterlab", "pyyaml", "pydantic", "loguru", "nova-galaxy>=0.9.1,<0.10",
dependencies = [
"numpy",
"scipy",
"pandas",
"astropy",
"matplotlib",
"tifffile",
"jupyterlab",
"dxchange",
"pyyaml",
"scikit-image",
"pydantic",
"loguru",
"nova-galaxy>=0.7.4,<0.8",

]

[project.urls]
Expand Down Expand Up @@ -123,6 +137,9 @@ jupyterlab = ">=4.4.1,<5"
pyyaml = ">=6.0.2,<7"
pydantic = ">=2.11.3,<3"
loguru = ">=0.7.2,<0.8"
dxchange = ">=0.1.8,<0.2"
h5py = ">=3.13.0,<4"
tomopy = ">=1.14.4,<2"

[tool.pixi.tasks]
# PyPi packaging tasks
Expand Down
111 changes: 111 additions & 0 deletions src/pleiades/processing/__init__.py
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
Loading