-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Define a better API for products #122
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #122 +/- ##
===========================================
- Coverage 72.53% 24.40% -48.14%
===========================================
Files 31 30 -1
Lines 1857 1500 -357
===========================================
- Hits 1347 366 -981
- Misses 510 1134 +624 ☔ View full report in Codecov by Sentry. |
meta = self.meta.copy() | ||
idb = self.idb_versions.copy() | ||
ci = set(data["control_index"]) | ||
control = self.control[np.argwhere(np.isin(self.control["index"], list(ci)))].copy() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this work but really need to rename and add a few more properties for this to make sense. Convert all the masks to be named _mask
or _requested
and then add some more props for detectors
, pixels
, energies
which would indicate what contained in the object which would be less/different to the request as slice, rebin or crops.
|
||
""" | ||
|
||
def __getitem__(self, item: Union[int, tuple[int, ...], slice]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def __getitem__(self, item: Union[int, tuple[int, ...], slice]): | |
def __getitem__(self, item: Union[int, tuple[int, slice, ...], slice]): |
|
||
""" | ||
|
||
def rebin_by_vales(self, *values, operator: Callable = np.sum): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def rebin_by_vales(self, *values, operator: Callable = np.sum): | |
def rebin_by_values(self, *values, operator: Callable = np.sum): |
|
||
Examples | ||
-------- | ||
cpd.rebin(None, None, None, [1, 5]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be good for this to follow the NDCube.rebin
API as much as makes sense. In that case, rebin
should take:
- integers which are an integer factor of the length of the axis to which it corresponds, or:
- a sequence of indices representing the bin edges along that axis.
In this case, the equivalent API for no rebinning should be 1
, not None
.
Alternatively, this method could be renamed to avoid confusion with NDCube.rebin
to something like rebin_by_edges
. In that case, it could take None
or a sequence of indices for each axis.
""" | ||
An `astropy.units.Quantiy` array giving the duration or integration time | ||
""" | ||
return self.data["timedel"] | ||
|
||
def crop_by_value( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def crop_by_value( | |
def crop_by_values( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this function take high-level objects, e.g. Time
, SkyCord
, SpectralCoord
? Or just lower level Quantity
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Low level objects plus a few strings for different pixel/detector combos e.g cpd.crop_by_vales([Time(...), Time(...)], None, 'big', [4, 10]*u.keV)
. Since the axis have well defined should be easy to validate.
No description provided.