vbonvin / POUET

Programming Observations Usefully at Euler Telescope
GNU General Public License v3.0
1 stars 1 forks source link

Changing telescope location to northwestern hemisphere gives wrong predictions #72

Closed vbonvin closed 4 years ago

vbonvin commented 4 years ago

Reported by @aymgal

vbonvin commented 4 years ago

Nasty hardcoding is nasty.

The source of the bug comes from the meteo.get_twilight function, where we had:

    obs_time = Time('%s 05:00:00' % obs_night, format='iso', scale='utc') #5h UT is approx. the middle of the night 

5h UT is approximately the middle of the night in La Silla (and at coordinates with the same longitude, like the VATT), but not at other locations. Typically in the East (like Maidanak observatory) this corresponds to middle of the day - thus, the time from previous sunset to next sunrise would span 1 day and a half instead of half a day.

Then, the following line reads

    obs_time = Time(obs_time.mjd +1 , format='mjd', scale='utc') # That corresponds to the next middle of the observing night.

The +1 is a dirty trick once again proper to La Silla (and similar longitude observatories). For a given start of the night, say 2019-12-01, the middle of that observing night is approx 05h UTC in the next calendar day, i.e. 2019-12-02. If one sets the middle of the night hour in the first line to be e.g. 20h UTC in the first line of code, then one should remove the +1 in the second line.

@aymgal, as a quick temporary fix for Maidanak you can simply replace these two lines of code by

    obs_time = Time('%s 20:00:00' % obs_night, format='iso', scale='utc') 
    obs_time = Time(obs_time.mjd, format='mjd', scale='utc')

This should solve your problem. I'll work on a fix that sets these values correctly based on the observing site coordinates and let you know when it's done

kuntzer commented 4 years ago

"It will be easy to generalise the code later." I prefer not to look at the blame for those lines ;) nice to know pouet has not descended into oblivion! null

aymgal commented 4 years ago

Thanks!