-
Notifications
You must be signed in to change notification settings - Fork 0
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/site events #2
Conversation
In the next couple of days I am going to PEP8 all my code and use a more
consistent convention so the frags_of_a_name become fragments_of_a_name.
Another one Matt mentioned is using" i in range(...)" instead of item or
index, or something more descriptive. There is another pratfall with
single-letter variable names : Many of them conflict with pdb commands. I
have basically decided no two character names allowed.
…On Wed, Aug 12, 2020 at 1:57 PM Tim Beccue ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In api/events.py
<#2 (comment)>:
> + '''Gets the local noon preceeding the given time, in julian days
+
+ May show unexpected behavior around DST transitions.
+
+ Args:
+ timezone (str): timezone name, ie. 'America/Los_Angeles'
+ time (float): unix time in seconds
+
+ Returns:
+ float: TAI in julian days denoting local noon.
+ '''
+ ts = api.load.timescale(builtin=True)
+ #unix_time = ts.tai_jd(time).utc_datetime().timestamp()
+ timeObj = ts.from_datetime(datetime.fromtimestamp(time, tz=pytz.timezone('utc')))
+ offset_days = _getTzOffset(timezone, time) / 24
+ localNoon = int(timeObj.tai + offset_days) - offset_days
Good points! I refreshed myself on pep8 half way through this project but
forgot to change the old names.
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#2 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACTZ3MHUKFYFRQQEGNHW4FLSAL65JANCNFSM4P5DMVAA>
.
--
Clear skies,
Wayne Rosing
Founder
805 708 6901 cell
805 880 1603 office
Please note [email protected] is our preferred address.
|
@wrosing @timbeccue Just searching around, I found this utility to perform pep8 checks. We use this in an automated fashion to check every commit made to BANZAI using TravisCI. |
@wrosing and @timbeccue I noticed that there a lot of committed .pyc files. You should probably remove those and add them to your .gitignore. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved, since my comments were addressed
Story: https://www.pivotaltracker.com/story/show/173955139
This pull request adds an additional endpoint that returns notable day/night events over a 24 hour period at an observatory. For example: sunset/twilight/calibration frame acquisition times.
A number of files have small changes because I moved all the python code into the top level
api
directory as (I recently learned) is standard in python applications.The bulk of the work happens in
api/events.py
. This is the code that calculates the events of interest. It is a rewrite of the original file from ptr-observatory (here: https://github.com/LCOGT/ptr-observatory/blob/dev/ptr_events.py) using the skyfield package instead of ephem, per Wayne's request.Unit tests are included in
api/tests/test_events.py
. This is my first serious attempt at unit tests so some things may look weird, but I hope it's mostly straightforward.The
serverless.yaml
file includes the new api definition, which runs a function inapi/events_handler.py
which assembles the events dictionary to return. It also includes http error handling.Finally, the readme has been updated to document the new endpoint. I've also deployed a test version of these additions to verify that it all works as intended.
note to future self: more frequent logical commits (with descriptive titles) makes pull requests easier to parse.