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

Refactor hour angle calculation #30

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Refactor hour angle calculation #30

wants to merge 3 commits into from

Conversation

aknierim
Copy link
Member

@aknierim aknierim commented Jun 13, 2024

This replaces the loops in the hour angle calculation

ha_all = Angle(
    [t.sidereal_time("apparent", "greenwich") - src_crd.ra for t in time]
)

in observation.py and data_set.py with array operations

ha_all = time.sidereal_time("apparent", "greenwich") - src_crd.ra.to(
    un.hourangle
)

resulting in a (small) performance boost of the code.

Copy link

codecov bot commented Jun 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (3fc7db5) to head (434af1a).
Report is 61 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #30   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         4           
  Lines           77        77           
=========================================
  Hits            77        77           

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

@aknierim aknierim marked this pull request as ready for review June 19, 2024 12:39
@aknierim aknierim requested a review from Kevin2 June 23, 2024 19:42
@Kevin2
Copy link
Member

Kevin2 commented Jun 24, 2024

How did you test the calculations to guarantee that the refactoring still works? Could we use some of these tests as tests in the workflow?

@aknierim
Copy link
Member Author

We should definitely think of tests for this in the future

@maxnoe
Copy link

maxnoe commented Jul 11, 2024

Is this computing local hour angle for a source?

If yes, It think the correct solution would be to use astropy coordinate transformation into the correspondig frame, not by hand computations using time.

I think the correct frame is: https://docs.astropy.org/en/stable/api/astropy.coordinates.HADec.html#astropy.coordinates.HADec

@aknierim
Copy link
Member Author

Is this computing local hour angle for a source?

Yes, relative to Greenwich.

If yes, It think the correct solution would be to use astropy coordinate transformation into the correspondig frame, not by hand computations using time.

I think the correct frame is: https://docs.astropy.org/en/stable/api/astropy.coordinates.HADec.html#astropy.coordinates.HADec

I was actually looking for something like this. Will give it a try, thank you.

@aknierim aknierim added the enhancement New feature or request label Dec 6, 2024
@Kevin2
Copy link
Member

Kevin2 commented Jan 24, 2025

what is the state of this idea? is it easy to try or should we focus on different stuff for now?

@aknierim
Copy link
Member Author

aknierim commented Jan 24, 2025

For some reason my current implementation of the GHA implementation off by one hour to the implementation on the main branch. We should look into why that is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants