Skip to content

Commit

Permalink
Merge pull request #35 from ManuelHu/enr_metadata
Browse files Browse the repository at this point in the history
also implement reading enrichment from future metadata scheme
  • Loading branch information
ManuelHu authored Jun 7, 2024
2 parents e486a4f + a7c9b2c commit 509a43a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/legendhpges/make_hpge.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,13 @@ def make_hpge(
if gedet_meta.production.enrichment is None:
msg = "The enrichment argument in the metadata is None."
raise ValueError(msg)
kwargs["material"] = make_enriched_germanium(gedet_meta.production.enrichment)
# representation of enrichment data changed in legend-exp/legend-detectors PR #43 to
# value and uncertainty.
if isinstance(gedet_meta.production.enrichment, float):
enrichment = gedet_meta.production.enrichment
else:
enrichment = gedet_meta.production.enrichment.val
kwargs["material"] = make_enriched_germanium(enrichment)

if name is None:
if gedet_meta.name is None:
Expand Down
4 changes: 2 additions & 2 deletions src/legendhpges/materials.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def _make_natural_germanium() -> g4.MaterialCompound:
return matenrge


def enriched_germanium_density(ge76_fraction: float = 0.92) -> float:
def enriched_germanium_density(ge76_fraction: float = 0.92) -> Quantity:
"""Calculate the density of enriched germanium.
Parameters
Expand All @@ -90,7 +90,7 @@ def enriched_germanium_density(ge76_fraction: float = 0.92) -> float:
return (_number_density_meas() * m_eff / n_avogadro).to("g/cm^3")


def make_enriched_germanium(ge76_fraction: float = 0.92) -> g4.MaterialCompound:
def make_enriched_germanium(ge76_fraction: float = 0.92) -> g4.Material:
"""Enriched germanium material builder.
Note
Expand Down

0 comments on commit 509a43a

Please sign in to comment.