Skip to content

Commit 987ffae

Browse files
authored
Fix internal std (#43)
* Refactor assertions in enzymeml.py for improved readability - Simplified assertion statements in the add_data, setup_external_calibrators, and extract_measurement_conditions functions for better clarity. - Updated the handling of concentration unit representation in setup_internal_calibrators to directly use the unit name. - Ensured consistent formatting of assertion messages across the file. * Update version to 0.10.3 and reorganize pyproject.toml - Bumped the version in `__init__.py` and `pyproject.toml` to 0.10.3. - Reorganized the `pyproject.toml` file to move the build-system and dependency-groups sections to the correct position for clarity. * Refactor assertion statements in utility.py for improved readability - Simplified assertion formatting in the _resolve_chromatogram function to enhance clarity and maintain consistency in error messages when handling multiple chromatograms. * Sort file paths in AgilentCSVReader for consistent processing order
1 parent 0931e3f commit 987ffae

File tree

5 files changed

+27
-27
lines changed

5 files changed

+27
-27
lines changed

chromhandler/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,4 @@ def __getattr__(name: str) -> Handler:
5555

5656
__all__ = ["Handler", "ChromAnalyzer", "Molecule", "Protein", "to_enzymeml"]
5757

58-
__version__ = "0.10.2"
58+
__version__ = "0.10.3"

chromhandler/enzymeml.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ def setup_internal_calibrators(
639639
standard_molecule_id=internal_standard.id,
640640
molecule_init_conc=molecule.init_conc,
641641
standard_init_conc=internal_standard.init_conc,
642-
molecule_conc_unit=molecule.conc_unit.name,
642+
molecule_conc_unit=molecule.conc_unit,
643643
molecule_t0_signal=peak_analyte.area,
644644
standard_t0_signal=peak_internal_standard.area,
645645
)

chromhandler/readers/agilent_csv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def read(self) -> list[Measurement]:
2020
"""
2121

2222
measurements = []
23-
for path_idx, csv_path in enumerate(self.file_paths):
23+
for path_idx, csv_path in enumerate(sorted(self.file_paths)):
2424
peaks = self._read_peaks_from_csv(csv_path)
2525
chromatogram = Chromatogram(peaks=peaks)
2626

chromhandler/utility.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ def _resolve_chromatogram(
1919
return chromatograms[0]
2020

2121
if len(chromatograms) > 1:
22-
assert wavelength is not None, (
23-
"Multiple chromatograms found, but no wavelength is specified."
24-
)
22+
assert (
23+
wavelength is not None
24+
), "Multiple chromatograms found, but no wavelength is specified."
2525

2626
# check that any of the chromatograms has the specified wavelength
27-
assert any([chrom.wavelength == wavelength for chrom in chromatograms]), (
28-
f"No chromatogram found with wavelength {wavelength} nm."
29-
)
27+
assert any(
28+
[chrom.wavelength == wavelength for chrom in chromatograms]
29+
), f"No chromatogram found with wavelength {wavelength} nm."
3030

3131
return next(chrom for chrom in chromatograms if chrom.wavelength == wavelength)
3232

pyproject.toml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,3 @@
1-
[build-system]
2-
build-backend = "hatchling.build"
3-
requires = ["hatchling>=1.27"]
4-
5-
[dependency-groups]
6-
dev = [
7-
"pre-commit>=3.7,<4",
8-
"ruff>=0.6,<1",
9-
"pytest>=8.0.2",
10-
"devtools>=0.12.2",
11-
"mkdocs-material>=9.6.16",
12-
"mkdocstrings[python]>=0.30.0",
13-
"nbval>=0.11.0",
14-
"mkdocs-jupyter>=0.25.1",
15-
"pyright>=1.1.405"
16-
]
17-
181
[project]
192
authors = [{email = "83341109+haeussma@users.noreply.github.com", name = "haeussma"}]
203
dependencies = [
@@ -30,7 +13,24 @@ license = {text = "MIT"}
3013
name = "chromhandler"
3114
readme = "README.md"
3215
requires-python = ">=3.10,<3.15"
33-
version = "0.10.2"
16+
version = "0.10.3"
17+
18+
[build-system]
19+
build-backend = "hatchling.build"
20+
requires = ["hatchling>=1.27"]
21+
22+
[dependency-groups]
23+
dev = [
24+
"pre-commit>=3.7,<4",
25+
"ruff>=0.6,<1",
26+
"pytest>=8.0.2",
27+
"devtools>=0.12.2",
28+
"mkdocs-material>=9.6.16",
29+
"mkdocstrings[python]>=0.30.0",
30+
"nbval>=0.11.0",
31+
"mkdocs-jupyter>=0.25.1",
32+
"pyright>=1.1.405",
33+
]
3434

3535
[project.urls]
3636
Homepage = "https://github.com/haeussma/chromhandler"

0 commit comments

Comments
 (0)