Skip to content
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

Feature/visualize fpr value #42

Merged
merged 23 commits into from
Feb 12, 2023
Merged

Feature/visualize fpr value #42

merged 23 commits into from
Feb 12, 2023

Conversation

Jammy2211
Copy link
Owner

The plan was to originally add a simple value of FPR (level of charge injeciton) in certain images for PyAutoCTI.

It turns out, estimating this value required a reworking of the extraction methods which extract the charge injection.

@Jammy2211 Jammy2211 requested a review from rhayes777 February 9, 2023 19:33
@Jammy2211 Jammy2211 merged commit 7ea1941 into main Feb 12, 2023
self.layout.extract.parallel_fpr.median_list_from(
array=self.data,
pixels_from_end=min(
10, self.layout.smallest_parallel_rows_within_ci_regions
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe assign 10 to a constant so it's clear what it means rather than just being an arbitrary integer value?

Comment on lines +17 to +18
class ExtractException(Exception):
pass
Copy link
Collaborator

Choose a reason for hiding this comment

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

Docs?

Comment on lines +51 to +54
return [
self.region_list[i + 1].x0 - self.region_list[i].x1
for i in range(len(self.region_list) - 1)
]
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can also do

[second.x0 - first.x1 for first, second in zip(self.region_list, self.region_list[1:])]

new_array: aa.Array1D,
array: aa.Array1D,
pixels: Optional[Tuple[int, int]] = None,
pixels_from_end: Optional[int] = None,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess that decorator I mentioned in the other PR would also be applicable here

charge injection region.
"""
return [
self.region_list[i + 1].y0 - self.region_list[i].y1
Copy link
Collaborator

Choose a reason for hiding this comment

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

That zip syntax would also work here

array.mask[region.slice] for region in self.region_list_from(pixels=pixels)
array.mask[region.slice]
for region in self.region_list_from(
pixels=pixels, pixels_from_end=pixels_from_end
Copy link
Collaborator

Choose a reason for hiding this comment

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

That pixels from end to pixels decorator would save so many changes. In particular I would suggest using it at whatever point you first call a function.

Even if you weren't using the decorator doing the conversion then passing pixels rather than two optional arguments to all of these functions would be much cleaner. You've had to make an absolute ton of changes just to support having one of two possible arguments between which there is a simple relationship.

Comment on lines 60 to 66
@property
def parallel_fpr(self):
return Extract2DParallelFPR(
shape_2d=self.shape_2d,
region_list=self.region_list,
parallel_overscan=self._parallel_overscan,
serial_prescan=self._serial_prescan,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Docs?


assert (
fpr_list[1].mask
== np.array([[True, False, False], [False, True, False], [False, False, True]])
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think if you put a comma before the closing bracket this will format over new lines which I find clearer for 2D arrays

@Jammy2211 Jammy2211 deleted the feature/visualize_fpr_value branch June 12, 2023 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants