mirror of
https://github.com/pim-n/pg-rad
synced 2026-02-02 14:33:09 +01:00
refactor to change Source to PointSource
This commit is contained in:
@ -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.
|
||||||
|
|||||||
Reference in New Issue
Block a user