Factor factory

This commit is contained in:
linarphy 2025-07-10 14:28:33 +02:00
parent 89280e6cc8
commit c4a005f913
Signed by: linarphy
GPG key ID: 0CBF02E039B4FFFF
3 changed files with 36 additions and 27 deletions

View file

@ -1,6 +1,10 @@
from ..factory.component import ComponentFactory from ..factory.component import ComponentFactory
from ..factory.scatterer import ScattererFactory from ..factory.scatterer import ScattererFactory
from ..factory.measurement import MeasurementFactory from ..factory.measurement import MeasurementFactory
from ..factory.initializer import (
InitializerComponent,
InitializerScatterer,
)
__all__ = [ __all__ = [
"ComponentFactory", "ComponentFactory",

View file

@ -0,0 +1,28 @@
from astropy.units import Quantity
from typing import NamedTuple
from astropy.units.physical import length, electrical_potential
from ..metadata.injection import (
Injection,
)
class InitializerComponent(NamedTuple):
"""
Class to store metadata before knowing the data associated to the
component
"""
name: str
calibration_factor: Quantity[length / electrical_potential]
class InitializerScatterer(NamedTuple):
"""
Class to store metadata before knowing the data associated to the
scatterer (the scatterer metadata contains component data).
"""
name: str
calibration_factor: Quantity[length / electrical_potential]
associated_component: InitializerComponent | None
injection: Injection | None

View file

@ -1,18 +1,14 @@
from typing import NamedTuple
from astropy.units import ( from astropy.units import (
Quantity, Quantity,
W, # pyright: ignore[reportAttributeAccessIssue] W, # pyright: ignore[reportAttributeAccessIssue]
mW, # pyright: ignore[reportAttributeAccessIssue] mW, # pyright: ignore[reportAttributeAccessIssue]
Unit, Unit,
) )
from astropy.units.physical import time, length, electrical_potential from astropy.units.physical import time
from gwpy.time import Time from gwpy.time import Time
from ..component import Component from ..component import Component
from ..lockingstate import LockingState from ..lockingstate import LockingState
from ..metadata.injection import (
Injection,
)
from ..measurement import Measurement from ..measurement import Measurement
from ..scatterer import Scatterer from ..scatterer import Scatterer
from ..utils import download_dicttimeseries, download_timeseries from ..utils import download_dicttimeseries, download_timeseries
@ -23,28 +19,9 @@ from ..metadata.scatterer import Scatterer as MetadataScatterer
from ..factory.component import ComponentFactory from ..factory.component import ComponentFactory
from ..factory.scatterer import ScattererFactory from ..factory.scatterer import ScattererFactory
from ..factory.initializer import (
InitializerScatterer,
class InitializerComponent(NamedTuple): )
"""
Class to store metadata before knowing the data associated to the
component
"""
name: str
calibration_factor: Quantity[length / electrical_potential]
class InitializerScatterer(NamedTuple):
"""
Class to store metadata before knowing the data associated to the
scatterer (the scatterer metadata contains component data).
"""
name: str
calibration_factor: Quantity[length / electrical_potential]
associated_component: InitializerComponent | None
injection: Injection | None
class MeasurementFactory: class MeasurementFactory: