Skip to content

Commit

Permalink
Moved PointSource flag_contains to a class property
Browse files Browse the repository at this point in the history
  • Loading branch information
aymgal committed Nov 16, 2023
1 parent e5b7539 commit de42d72
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions coolest/template/classes/profiles/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,10 @@ class PointSource(AnalyticalProfile):
- 'x_lensed': list of coordinates along the x axis of the multiple images
- 'y_lensed': list of coordinates along the y axis of the multiple images
- 'f_lensed': list of fluxes (in data units) of the multiple images
- 'flag_contains' ('intrinsic','lensed','both'): whether the profile contains only the lensed properties, only the intrinsic ones, or both
It also has a property to dynamically check what the point source profile is describing:
- 'flag_contains' ('intrinsic','lensed','both', None):
whether the profile contains only the lensed properties, only the intrinsic ones, both, or nothing.
"""

def __init__(self):
Expand All @@ -165,12 +168,21 @@ def __init__(self):
'f_lensed': LinearParameterSet("Set of flux values (in data units) of the multiple images",
DefinitionRange(min_value=0.0),
latex_str=r"$A$"),
'flag_contains': LinearParameter("Flag contains",
DefinitionRange(),
latex_str=r"Contains"),
}
super().__init__(parameters)

@property
def flag_contains(self):
flag_int = self.parameters['f_intrinsic'].point_estimate.value is not None
flag_len = self.parameters['f_lensed'].point_estimate.value is not None
if flag_int and flag_len:
return 'both'
elif flag_int:
return 'intrinsic'
elif flag_len:
return 'intrinsic'
return None


class Uniform(AnalyticalProfile):
"""Uniform surface brightness profile.
Expand Down

0 comments on commit de42d72

Please sign in to comment.