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

Tighten up API, tidy docs, #58

Merged
merged 6 commits into from
May 26, 2024
Merged

Conversation

samaloney
Copy link
Member

@samaloney samaloney commented May 13, 2024

  • Tidy and tighten API
    • Use Quantity decorator where possible
    • Added type hints + checked with mypy
    • Visibility object have phase_centre and offset
  • Added per module documentation pages
  • Fixed bug with in transform code
  • Add fft equivalence test

Demo in stixpy will have to be updated once this is merged

Closes #57, #54, #33, #37

Copy link

codecov bot commented May 13, 2024

Codecov Report

Attention: Patch coverage is 88.15166% with 25 lines in your changes are missing coverage. Please review.

Please upload report for BASE (main@4f1d619). Learn more about missing BASE report.

Files Patch % Lines
xrayvision/visibility.py 74.00% 13 Missing ⚠️
xrayvision/clean.py 81.63% 9 Missing ⚠️
xrayvision/imaging.py 93.33% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main      #58   +/-   ##
=======================================
  Coverage        ?   89.29%           
=======================================
  Files           ?        7           
  Lines           ?      850           
  Branches        ?        0           
=======================================
  Hits            ?      759           
  Misses          ?       91           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

img[32, 32] = 1.0 * (apu.ph / apu.arcsec**2)
obs_vis = dft_map(img, u=u, v=v, pixel_size=[2.0, 2.0] * apu.arcsec)
img = np.zeros((65, 65)) * (apu.ph / apu.cm**2)
img[32, 32] = 1.0 * (apu.ph / apu.cm**2)
Copy link
Contributor

Choose a reason for hiding this comment

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

Aren't the units of a map photons (or counts) s^-1 cm^-2 keV^-1 arcsec^-2? I think the normalization by arcsec^2 is needed given pixel_size of dft_map is in apu.arcsec / apu.pix. The normalization by s and keV can be neglected if not considered here

Copy link
Member Author

Choose a reason for hiding this comment

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

The units here don't really matter but I should double check that the result of the idft have what ever units the input visibility have with an additional arcsec^-2

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok thanks!

Copy link
Member Author

Choose a reason for hiding this comment

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

So currently the underlying code dft, idft don't really do anything with the units , specifically idft(vis, ....) will return something with the units of vis and doesn't add the 1/arcsec^2 it really should. Similarly dft(an_array, ...) doesn't check if an_array has 1/arcsec^2 in its units and just return vis with the same units as an_array.

Copy link
Contributor

@paolomassa paolomassa left a comment

Choose a reason for hiding this comment

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

Everything looks good to me besides a couple of lines where I left comments

@samaloney
Copy link
Member Author

Great thanks for the review @paolomassa

* Optonal args are now keyword only
* Use of qantity aware type annotations
* Doc refaactor - page per submodule
* Fix bug in transform code
* Add fft equivalence test
@samaloney samaloney merged commit 6c46be2 into TCDSolar:main May 26, 2024
13 checks passed
@@ -48,7 +50,7 @@ def time_range(self) -> Optional[Iterable[Time]]:

@property
@abc.abstractmethod
def vis_labels(self) -> Optional[Iterable[str]]:
def vis_labels(self) -> Sequence[Iterable[str]]:
Copy link
Contributor

Choose a reason for hiding this comment

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

Since vis_labels isn't required, should this be Optional[Sequence[str]]? Or perhaps Optional[Sequence[Iterable[str]]]?

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.

Support phase and image centre being different
3 participants