Skip to content

Commit

Permalink
skip lines with no intensity if threshold set
Browse files Browse the repository at this point in the history
  • Loading branch information
jveitchmichaelis committed Aug 12, 2023
1 parent 997fc30 commit 1b51b57
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/rascal/atlas.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,11 @@ def add_lines(
elif line["wavelength"] > self.max_atlas_wavelength:
continue

if "intensity" in line and line["intensity"] < self.min_intensity:
if (
"intensity" not in line
or line["intensity"] < self.min_intensity
):
continue
else:
line["intensity"] = 0

self.atlas_lines.append(
AtlasLine(
Expand Down
10 changes: 7 additions & 3 deletions test/test_atlas.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,12 @@ def test_load_nist_single(elements):
)

for line in nist_atlas.get_lines():
assert line > min_wavelength, "Line is less than min wavelength"
assert line < max_wavelength, "Line is greater than max wavelength"
assert line > (
min_wavelength - nist_atlas.range_tolerance
), "Line is less than min wavelength"
assert line < (
max_wavelength + nist_atlas.range_tolerance
), "Line is greater than max wavelength"

time_end = time.perf_counter()
elapsed = time_end - time_start
Expand All @@ -68,7 +72,7 @@ def test_load_with_min_intensity():
)

for i in nist_atlas.get_intensities():
assert i > min_intensity, "Line intensity is below minimum"
assert i >= min_intensity, "Line intensity is below minimum"


def test_load_nist_all(elements):
Expand Down

0 comments on commit 1b51b57

Please sign in to comment.