Skip to content
Draft
Show file tree
Hide file tree
Changes from 3 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: 4 additions & 0 deletions src/nectarchain/data/container/gain_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ class GainContainer(NectarCAMContainer):
)
low_gain = Field(type=np.ndarray, dtype=np.float64, ndim=2, description="low gain")
pixels_id = Field(type=np.ndarray, dtype=np.uint16, ndim=1, description="pixel ids")
charge = Field(type=np.ndarray, dtype=np.float64, ndim=1, description="charge")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to create a PhotostatContainer to let the gain container in a high abstraction level, the charge and charge_std fileds are not needed in the SPEfitContainer which inherits from the gaincontainer

charge_std = Field(
type=np.ndarray, dtype=np.float64, ndim=1, description="charge_std"
)

@classmethod
def from_hdf5(cls, path, group_name="data"):
Expand Down
5 changes: 5 additions & 0 deletions src/nectarchain/makers/component/photostatistic_algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ def __init__(
high_gain=np.zeros((self.npixels, 3)),
low_gain=np.zeros((self.npixels, 3)),
pixels_id=self._pixels_id,
charge=np.zeros((self.npixels, 1)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here return the PhotoStatContainer

charge_std=np.zeros((self.npixels, 1)),
)

@classmethod
Expand Down Expand Up @@ -141,6 +143,9 @@ def run(self, pixels_id: np.ndarray = None, **kwargs) -> None:
(self.gainLG * mask, gainLG_err, gainLG_err)
).T
self._results.is_valid = mask
log.info("Trying to write charges")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should make it clear everywhere that these 2 new fields are for the high-gain channel ? E.g. by renaming them charge_hg and charge_hg_std everywhere ?

self._results.charge = self.meanChargeHG
self._results.charge_std = self.sigmaChargeHG

figpath = kwargs.get("figpath", False)
if figpath:
Expand Down
Loading