refactor to change Source to PointSource

This commit is contained in:
Pim Nelissen
2026-01-28 09:16:26 +01:00
parent b2120fa991
commit 47197e5e11

View File

@ -3,7 +3,7 @@ from matplotlib.patches import Circle
import numpy as np import numpy as np
from pg_rad.path import Path from pg_rad.path import Path
from pg_rad.objects import Source from pg_rad.sources import PointSource
class Landscape: class Landscape:
"""A generic Landscape that can contain a Path and sources. """A generic Landscape that can contain a Path and sources.
@ -30,7 +30,7 @@ class Landscape:
self.scale = scale self.scale = scale
self.path: Path = None self.path: Path = None
self.sources: list[Source] = [] self.sources: list[PointSource] = []
def plot(self, z = 0): def plot(self, z = 0):
"""Plot a slice of the world at a height `z`. """Plot a slice of the world at a height `z`.
@ -76,11 +76,11 @@ class Landscape:
return fig, ax return fig, ax
def add_sources(self, *sources: Source): def add_sources(self, *sources: PointSource):
"""Add one or more point sources to the world. """Add one or more point sources to the world.
Args: Args:
*sources (pg_rad.objects.Source): One or more sources, passed as *sources (pg_rad.sources.PointSource): One or more sources, passed as
Source1, Source2, ... Source1, Source2, ...
Raises: Raises:
ValueError: If the source is outside the boundaries of the landscape. ValueError: If the source is outside the boundaries of the landscape.