change intra-package import statements to have absolute path. this to avoid circular importing. the imports specified in __init__ of each module are only intended to be used outside of src (e.g. tests, API usage).

This commit is contained in:
Pim Nelissen
2026-02-17 10:11:03 +01:00
parent 5684525d0f
commit c2b05c63a8
6 changed files with 10 additions and 28 deletions

View File

@ -2,7 +2,7 @@ import logging
import pandas as pd import pandas as pd
from pg_rad.exceptions import DataLoadError, InvalidCSVError from pg_rad.exceptions.exceptions import DataLoadError, InvalidCSVError
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@ -1,4 +1,4 @@
from pg_rad.physics import get_mass_attenuation_coeff from pg_rad.physics.attenuation import get_mass_attenuation_coeff
class Isotope: class Isotope:

View File

@ -2,9 +2,9 @@ from importlib.resources import files
import logging import logging
from pg_rad.configs.filepaths import TEST_EXP_DATA from pg_rad.configs.filepaths import TEST_EXP_DATA
from pg_rad.isotopes import CS137 from pg_rad.isotopes.presets import CS137
from pg_rad.landscape.landscape import LandscapeBuilder from pg_rad.landscape.landscape import LandscapeBuilder
from pg_rad.objects import PointSource from pg_rad.objects.sources import PointSource
class LandscapeDirector: class LandscapeDirector:

View File

@ -1,11 +1,10 @@
import logging import logging
from typing import Self from typing import Self
from pg_rad.dataloader import load_data from pg_rad.dataloader.dataloader import load_data
from pg_rad.exceptions import OutOfBoundsError from pg_rad.exceptions.exceptions import OutOfBoundsError
from pg_rad.objects import PointSource from pg_rad.objects.sources import PointSource
from pg_rad.path import Path, path_from_RT90 from pg_rad.path.path import Path, path_from_RT90
from pg_rad.physics.fluence import phi_single_source
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -44,23 +43,6 @@ class Landscape:
logger.debug(f"Landscape created: {self.name}") logger.debug(f"Landscape created: {self.name}")
def calculate_fluence_at(self, pos: tuple):
total_phi = 0.
for source in self.point_sources:
r = source.distance_to(pos)
phi_source = phi_single_source(
r=r,
activity=source.activity,
branching_ratio=source.isotope.b,
mu_mass_air=source.isotope.mu_mass_air,
air_density=self.air_density
)
total_phi += phi_source
return total_phi
def calculate_fluence_along_path(self):
pass
class LandscapeBuilder: class LandscapeBuilder:
def __init__(self, name: str = "Unnamed landscape"): def __init__(self, name: str = "Unnamed landscape"):

View File

@ -1,7 +1,7 @@
import logging import logging
from .objects import BaseObject from .objects import BaseObject
from pg_rad.isotopes import Isotope from pg_rad.isotopes.isotope import Isotope
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@ -3,7 +3,7 @@ import logging
from matplotlib import pyplot as plt from matplotlib import pyplot as plt
from matplotlib.patches import Circle from matplotlib.patches import Circle
from pg_rad.landscape import Landscape from pg_rad.landscape.landscape import Landscape
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)