API reference¶
Processing units¶
- class ampel.abstract.AbsLightCurveT2Unit.AbsLightCurveT2Unit(**kwargs)[source]¶
Base class for T2s that operate on light curves.
- static build(compound, datapoints)[source]¶
Create the parametrized type using compound and datapoints. For example, AbsCustomStateT2Unit[LightCurve] would return a
LightCurve
instance.- Return type:
- require: ClassVar[None | tuple[str, ...]] = {}¶
Resources requirements as class variable (passed on to and merged with subclasses).
- class ampel.abstract.AbsTiedLightCurveT2Unit.AbsTiedLightCurveT2Unit(*args, **kwargs)[source]¶
Bases:
AbsTiedCustomStateT2Unit
[LightCurve
,T
]- abstract process(light_curve, t2_views)[source]¶
Returned object should contain computed science results to be saved into the DB. Notes: dict must have only string keys and values must be bson encodable
- static get_link(link_override, light_curve)[source]¶
Method used by T2Processor. :type link_override:
dict
[Literal
['pps'
,'uls'
],Literal
['first'
,'middle'
,'last'
]] :param link_override: value associated with key ‘link_override’ of T2Dependency <ampel.struct.T2Dependency.T2Dependency> :rtype:UnionType
[None
,int
,bytes
] :returns: the value of ‘link’ (tied t2 documents) to be matched
- static build(compound, datapoints)[source]¶
Create the parametrized type using compound and datapoints. For example, AbsTiedCustomStateT2Unit[LightCurve] would return a
LightCurve
instance.- Return type:
- require: ClassVar[None | tuple[str, ...]] = {}¶
Resources requirements as class variable (passed on to and merged with subclasses).
- class ampel.abstract.AbsPhotoT3Unit.AbsPhotoT3Unit(**kwargs)[source]¶
Parametrized abstract class for T3 units receiving TransientView instances (and potentially LightCurve instances as well)
- require: ClassVar[None | tuple[str, ...]] = {}¶
Resources requirements as class variable (passed on to and merged with subclasses).
Data classes¶
- class ampel.view.LightCurve.LightCurve(compound_id, stock_id, photopoints=None, upperlimits=None)[source]¶
Contains a collection of
DataPoint
(photo points and upper limits), and a few convenience methods to return values from internal collections.- get_values(key, filters=None, of_upper_limits=False)[source]¶
- Parameters:
- Return type:
usage example:
lightcurve.get_values('jd')
See also
- get_tuples(key1, key2, filters=None, of_upper_limits=False)[source]¶
- Parameters:
- Return type:
usage example:
lightcurve.get_tuples('jd', 'magpsf', {'attribute': 'magpsf', 'operator': '<', 'value': 18})
See also
- get_ntuples(params, filters=None, of_upper_limits=False)[source]¶
- Parameters:
- Return type:
usage example:
lightcurve.get_ntuples(["fid", "jd", "magpsf"], {'attribute': 'magpsf', 'operator': '<', 'value': 18})
See also
- get_pos(ret='brightest', filters=None)[source]¶
Calculate the position of the underlying object.
- Parameters:
- Return type:
Get the position of the brightest PhotoPoint in the ZTF G band:
instance.get_pos( "brightest", {'attribute': 'alTags', 'operator': 'in', 'value': 'ZTF_G'} )
Get the position of the latest photopoint with a magnitude brighter than 18 (or an empty array if no photopoint matches this criteria):
instance.get_pos( "lastest", {'attribute': 'magpsf', 'operator': '<', 'value': 18} )
- class ampel.view.TransientView.TransientView(id, stock=None, origin=None, t0=None, t1=None, t2=None, logs=None, extra=None)[source]¶
Bases:
SnapView
-
lightcurve:
Optional
[Sequence
[LightCurve
]]¶
- get_journal_entries(tier=None, process_name=None, filter_func=None)¶
Get a subset of journal entries.
- Parameters:
- Return type:
- Returns:
journal entries corresponding to a given tier and/or job, sorted by timestamp.
- get_latest_t2_body(unit, link=None, code=None)¶
Get latest t2 body element from a given unit.
- get_raw_t2_body(unit, link=None, code=None)¶
- get_t2_body(unit, ret_type=<class 'dict'>, *, data_slice=-1, link=None, code=None, raise_exc=False)¶
Get latest t2 body element from a given unit. :type ret_type:
type
[TypeVar
(T
)] :param ret_type: expected body element type. If isinstance check is not fullfied None will be returned (unless multiple unit are to be matched and another unit fullfill the criteria) or an exception will be raised if raise_exc is True :type link:Union
[None
,int
,bytes
,str
] :param link: restrict to a specific link
- get_t2_ntuple(unit, key, rtype, *, no_none=False, require_all_keys=True, code=None)¶
Examples: get_t2_ntuple(“T2NedTap”, (“ra”, “dec”, “z”, “zunc”), float) get_t2_ntuple((“T2NedSNCosmo”, “T2SNCosmo”), (“fit_result”, “covariance”), dict)
see T2DocView.get_ntuple(…) for more info
- get_t2_value(unit, key, rtype, *, code=None)¶
Examples: get_t2_value((“T2NedSNCosmo”, “T2SNCosmo”), “fit_result”, dict)
see T2DocView.get_value(…) for more info
- get_t2_views(unit=None, link=None, code=None)¶
Get a subset of T2 documents.
-
logs:
Optional
[Sequence
[LogDocument
]]¶
-
stock:
Optional
[StockDocument
]¶
-
lightcurve: