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

[BUG] Fix how the start time for a given schedule is computed for efficiency #15

Closed
WWGolay opened this issue Aug 27, 2023 · 0 comments · Fixed by #81
Closed

[BUG] Fix how the start time for a given schedule is computed for efficiency #15

WWGolay opened this issue Aug 27, 2023 · 0 comments · Fixed by #81
Labels
bug Something isn't working good first issue Good for newcomers high priority A fix is requested ASAP

Comments

@WWGolay
Copy link
Collaborator

WWGolay commented Aug 27, 2023

The t0 variable in scripts like exoplanet_transits and schedtel is the observatory's local noon, stored in UTC. The rst script calculates this in the most efficient way using timezones; other scripts should also use this way:

tz = timezonefinder.TimezoneFinder().timezone_at(lng=lon.deg, lat=lat.deg)
tz = zoneinfo.ZoneInfo(tz)
logger.debug(f"tz = {tz}")

if date is None:
    logger.debug("Using current date at observatory location")
    date = datetime.datetime.now()
else:
    date = datetime.datetime.strptime(date, "%Y-%m-%d")
date = datetime.datetime(date.year, date.month, date.day, 12, 0, 0, tzinfo=tz)

t0 = astrotime.Time(
    datetime.datetime(date.year, date.month, date.day, 12, 0, 0, tzinfo=tz),
    format="datetime",
)
logger.debug(f"t0 = {t0}")
@WWGolay WWGolay added bug Something isn't working good first issue Good for newcomers low priority Preferences and optimizations high priority A fix is requested ASAP low effort and removed low priority Preferences and optimizations labels Aug 27, 2023
@WWGolay WWGolay linked a pull request Nov 14, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers high priority A fix is requested ASAP
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant