Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion firecrown/likelihood/number_counts.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
SourceGalaxySystematic,
PhotoZShiftFactory,
PhotoZShiftandStretchFactory,
SourceGalaxySelectFieldFactory,
Tracer,
)
from firecrown.metadata_types import InferredGalaxyZDist, TypeSource
Expand Down Expand Up @@ -613,7 +614,8 @@ def create_global(self) -> ConstantMagnificationBiasSystematic:
| LinearBiasSystematicFactory
| PTNonLinearBiasSystematicFactory
| MagnificationBiasSystematicFactory
| ConstantMagnificationBiasSystematicFactory,
| ConstantMagnificationBiasSystematicFactory
| SourceGalaxySelectFieldFactory,
Field(discriminator="type", union_mode="left_to_right"),
]

Expand Down
21 changes: 21 additions & 0 deletions firecrown/likelihood/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,27 @@
return replace(tracer_arg, field=self.field)


class SourceGalaxySelectFieldFactory(BaseModel):
"""Factory class for SourceGalaxySelectField objects."""

model_config = ConfigDict(extra="forbid", frozen=True)

field_name: str

type: Annotated[
Literal["SourceGalaxySelectFieldFactory"],
Field(description="The type of the systematic."),
] = "SourceGalaxySelectFieldFactory"

def create(self, bin_name: str) -> SourceGalaxySelectField:
"""Create a SourceGalaxySelectField object with the given field name."""
raise ValueError("SourceGalaxySelectField cannot be per-bin.")

Check warning on line 493 in firecrown/likelihood/source.py

View check run for this annotation

Codecov / codecov/patch

firecrown/likelihood/source.py#L493

Added line #L493 was not covered by tests

def create_global(self) -> SourceGalaxySelectField:
"""Create a PhotoZShift object with the given field name."""
return SourceGalaxySelectField(field=self.field_name)

Check warning on line 497 in firecrown/likelihood/source.py

View check run for this annotation

Codecov / codecov/patch

firecrown/likelihood/source.py#L497

Added line #L497 was not covered by tests


class SourceGalaxy(Source, Generic[_SourceGalaxyArgsT]):
"""Source class for galaxy based sources."""

Expand Down
4 changes: 3 additions & 1 deletion firecrown/likelihood/weak_lensing.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
SourceGalaxySystematic,
PhotoZShiftFactory,
PhotoZShiftandStretchFactory,
SourceGalaxySelectFieldFactory,
Tracer,
)
from firecrown.metadata_types import InferredGalaxyZDist, TypeSource
Expand Down Expand Up @@ -570,7 +571,8 @@ def create_global(self) -> TattAlignmentSystematic:
| PhotoZShiftandStretchFactory
| MultiplicativeShearBiasFactory
| LinearAlignmentSystematicFactory
| TattAlignmentSystematicFactory,
| TattAlignmentSystematicFactory
| SourceGalaxySelectFieldFactory,
Field(discriminator="type", union_mode="left_to_right"),
]

Expand Down
Loading