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

Add flat field method to Observatory - WIP #729

Closed
wants to merge 30 commits into from

Conversation

wtgee
Copy link
Member

@wtgee wtgee commented Nov 16, 2018

This is the actual method that takes the flat fields.

Edit: The flat-field overview has been moved to #732

This is pulled from #541.

@codecov
Copy link

codecov bot commented Nov 16, 2018

Codecov Report

Merging #729 into develop will increase coverage by 0.06%.
The diff coverage is 91.3%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #729      +/-   ##
===========================================
+ Coverage    80.58%   80.65%   +0.06%     
===========================================
  Files           61       61              
  Lines         5188     5211      +23     
  Branches       715      717       +2     
===========================================
+ Hits          4181     4203      +22     
- Misses         818      819       +1     
  Partials       189      189
Impacted Files Coverage Δ
pocs/observatory.py 90.14% <91.3%> (+0.08%) ⬆️
pocs/serial_handlers/protocol_arduinosimulator.py 99.6% <0%> (+0.39%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a7942df...5b3eb82. Read the comment docs.

conf_files/pocs.yaml Outdated Show resolved Hide resolved
pocs/observatory.py Show resolved Hide resolved
@@ -611,6 +618,156 @@ def close_dome(self):
self.logger.info('Closed dome')
return self.dome.close()

def take_flat_fields(self,
Copy link
Contributor

Choose a reason for hiding this comment

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

This method feels like it has too many parameters and responsibilities. I'd love to see it shorter, and composed from more (ideally) reusable methods.

Copy link
Member Author

Choose a reason for hiding this comment

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

Absolutely agree. Might happen here and might wait for future PR.

pocs/observatory.py Outdated Show resolved Hide resolved
time to each flat-field image.
Args:
which (str, optional): Specify either 'evening' or 'morning' to lookup coordinates
in config, default 'evening'.
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not just require alt and az be passed in, leave the caller with the responsibility to deal with time of day.

Copy link
Member Author

Choose a reason for hiding this comment

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

We also need to know if it is getting darker or brighter, i.e. is evening or morning, so that we can adjust the exposure time properly.

pocs/observatory.py Outdated Show resolved Hide resolved
pocs/observatory.py Outdated Show resolved Hide resolved
# Check the counts for each image
is_saturated = False
for cam_name, info in camera_events.items():
img_file = info['filename'].replace('.cr2', '.fits')
Copy link
Contributor

Choose a reason for hiding this comment

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

Lots of this loop looks like it could be extracted into helper methods.

pocs/observatory.py Outdated Show resolved Hide resolved
@@ -379,3 +379,18 @@ def test_operate_dome(config_with_simulated_dome):
assert observatory.open_dome()
assert observatory.dome.is_open
assert not observatory.dome.is_closed


def test_create_flat_field(observatory):
Copy link
Contributor

Choose a reason for hiding this comment

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

This implies that most of the new code is untested (i.e. no automated test, not that you haven't tested it on PAN001).

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. I had not marked this for review yet because I haven't written the tests. I just wrote some to cover the creation of the flat-field Observation but haven't yet figured out a good way to do the actual take_flat_field method. So far this PR is just extracting from #541. I'll mark as WIP until I think it is ready but as mentioned I might just end up with an alternative PR.

@wtgee wtgee mentioned this pull request Nov 20, 2018
13 tasks
MR Wilfred Gee and others added 5 commits November 23, 2018 07:43
and is working and we want to be able to use it on sky sooner than
we can probably work out the testing. Issue panoptes#732 includes testing as
part of its requirement.
@wtgee
Copy link
Member Author

wtgee commented Nov 23, 2018

@jamessynge @AnthonyHorton I am going to merge this tomorrow without any test coverage (there is a no cover pragma right now). Calls for testing are specified in #732, but I'd like to proceed with the ability to take flats from the pocs_shell fairly soon, i.e. before I can create a mock object for making proper testing of flats.

Let me know if there are any serious concerns with merging without tests. Note that the flat fielding is not yet integrated into the machine so this will not change any current behaviour.

wtgee added a commit to wtgee/POCS that referenced this pull request Nov 23, 2018
This will pass all `key=value` options directly to `Observatory.take_flat_fields`.

Dependent on panoptes#729
@wtgee wtgee added the One of Many PRs PR is part of a multi-part sequence of PRs label Nov 23, 2018
Copy link
Collaborator

@AnthonyHorton AnthonyHorton left a comment

Choose a reason for hiding this comment

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

I'm OK with merging this now without test coverage in order to facilitate more real world testing.

@wtgee
Copy link
Member Author

wtgee commented Nov 26, 2018

@jamessynge @AnthonyHorton I'm considering moving some of this logic up to the pocs level. Many items within take_flat_fields are duplicating things that pocs (but not pocs.observatory) are already capable of doing.

However it feels a bit odd to move it up to that level. Ideally it would just be abstracted into a mini separate state-machine loop.

@wtgee wtgee changed the title Add flat field method to Observatory Add flat field method to Observatory - WIP Dec 1, 2018
wtgee added a commit to wtgee/POCS that referenced this pull request Aug 19, 2022
* This method has been used off and on variously for a while. Ideally should be decoupled more from the hardware but getting it committed as is.

Replaces and closes panoptes#729.
@wtgee wtgee mentioned this pull request Aug 19, 2022
@wtgee wtgee closed this in #1173 Aug 20, 2022
wtgee added a commit that referenced this pull request Aug 20, 2022
* This method has been used off and on variously for a while. Ideally should be decoupled more from the hardware but getting it committed as is.

Replaces and closes #729.
@wtgee wtgee deleted the flat-field-method branch August 20, 2022 00:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
One of Many PRs PR is part of a multi-part sequence of PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants