mirror of
https://github.com/pim-n/pg-rad
synced 2026-03-22 21:48:11 +01:00
update landscape to work with new detector
This commit is contained in:
@ -15,7 +15,7 @@ from pg_rad.inputparser.specs import (
|
|||||||
RelativePointSourceSpec,
|
RelativePointSourceSpec,
|
||||||
DetectorSpec
|
DetectorSpec
|
||||||
)
|
)
|
||||||
|
from pg_rad.detector.detector import load_detector
|
||||||
from pg_rad.path.path import Path, path_from_RT90
|
from pg_rad.path.path import Path, path_from_RT90
|
||||||
|
|
||||||
from road_gen.generators.segmented_road_generator import SegmentedRoadGenerator
|
from road_gen.generators.segmented_road_generator import SegmentedRoadGenerator
|
||||||
@ -161,7 +161,7 @@ class LandscapeBuilder:
|
|||||||
))
|
))
|
||||||
|
|
||||||
def set_detector(self, spec: DetectorSpec) -> Self:
|
def set_detector(self, spec: DetectorSpec) -> Self:
|
||||||
self._detector = spec
|
self._detector = load_detector(spec.name)
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def _fit_landscape_to_path(self) -> None:
|
def _fit_landscape_to_path(self) -> None:
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from pg_rad.path.path import Path
|
from pg_rad.path.path import Path
|
||||||
from pg_rad.detector.detectors import AngularDetector, IsotropicDetector
|
from pg_rad.detector.detector import Detector
|
||||||
from pg_rad.objects.sources import PointSource
|
from pg_rad.objects.sources import PointSource
|
||||||
|
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ class Landscape:
|
|||||||
path: Path,
|
path: Path,
|
||||||
air_density: float,
|
air_density: float,
|
||||||
point_sources: list[PointSource],
|
point_sources: list[PointSource],
|
||||||
detector: IsotropicDetector | AngularDetector,
|
detector: Detector,
|
||||||
size: tuple[int, int, int]
|
size: tuple[int, int, int]
|
||||||
):
|
):
|
||||||
"""Initialize a landscape.
|
"""Initialize a landscape.
|
||||||
@ -28,6 +28,7 @@ class Landscape:
|
|||||||
path (Path): The path of the detector.
|
path (Path): The path of the detector.
|
||||||
air_density (float): Air density in kg/m^3.
|
air_density (float): Air density in kg/m^3.
|
||||||
point_sources (list[PointSource]): List of point sources.
|
point_sources (list[PointSource]): List of point sources.
|
||||||
|
detector (Detector): The detector object.
|
||||||
size (tuple[int, int, int]): Size of the world.
|
size (tuple[int, int, int]): Size of the world.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import sys
|
|||||||
|
|
||||||
from pandas.errors import ParserError
|
from pandas.errors import ParserError
|
||||||
|
|
||||||
from pg_rad.detector.builder import DetectorBuilder
|
|
||||||
from pg_rad.exceptions.exceptions import (
|
from pg_rad.exceptions.exceptions import (
|
||||||
MissingConfigKeyError,
|
MissingConfigKeyError,
|
||||||
OutOfBoundsError,
|
OutOfBoundsError,
|
||||||
@ -56,7 +55,9 @@ def main():
|
|||||||
acquisition_time: 1
|
acquisition_time: 1
|
||||||
|
|
||||||
path:
|
path:
|
||||||
length: 1000
|
length:
|
||||||
|
- 500
|
||||||
|
- 500
|
||||||
segments:
|
segments:
|
||||||
- straight
|
- straight
|
||||||
- turn_left: 45
|
- turn_left: 45
|
||||||
@ -69,19 +70,15 @@ def main():
|
|||||||
isotope: Cs137
|
isotope: Cs137
|
||||||
gamma_energy_keV: 661
|
gamma_energy_keV: 661
|
||||||
|
|
||||||
detector:
|
detector: LU_NaI_3inch
|
||||||
name: dummy
|
|
||||||
is_isotropic: True
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
cp = ConfigParser(test_yaml).parse()
|
cp = ConfigParser(test_yaml).parse()
|
||||||
landscape = LandscapeDirector.build_from_config(cp)
|
landscape = LandscapeDirector.build_from_config(cp)
|
||||||
detector = DetectorBuilder(cp.detector).build()
|
|
||||||
output = SimulationEngine(
|
output = SimulationEngine(
|
||||||
landscape=landscape,
|
landscape=landscape,
|
||||||
runtime_spec=cp.runtime,
|
runtime_spec=cp.runtime,
|
||||||
sim_spec=cp.options,
|
sim_spec=cp.options,
|
||||||
detector=detector
|
|
||||||
).simulate()
|
).simulate()
|
||||||
|
|
||||||
plotter = ResultPlotter(landscape, output)
|
plotter = ResultPlotter(landscape, output)
|
||||||
@ -91,10 +88,8 @@ def main():
|
|||||||
try:
|
try:
|
||||||
cp = ConfigParser(args.config).parse()
|
cp = ConfigParser(args.config).parse()
|
||||||
landscape = LandscapeDirector.build_from_config(cp)
|
landscape = LandscapeDirector.build_from_config(cp)
|
||||||
detector = DetectorBuilder(cp.detector).build()
|
|
||||||
output = SimulationEngine(
|
output = SimulationEngine(
|
||||||
landscape=landscape,
|
landscape=landscape,
|
||||||
detector=detector,
|
|
||||||
runtime_spec=cp.runtime,
|
runtime_spec=cp.runtime,
|
||||||
sim_spec=cp.options
|
sim_spec=cp.options
|
||||||
).simulate()
|
).simulate()
|
||||||
|
|||||||
Reference in New Issue
Block a user