-
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
Create a simple use example for a camera #226
Conversation
For the Vimba update in the |
f0db62e
to
970bfc9
Compare
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.
Looking good! Just some small stuff to address.
The big question we need to answer here is whether we can move some of the GUI stuff into the actual catkit2
package. @erinpougheon how about you address the comments I left, and then we try to estimate together whether this is doable?
@@ -20,7 +20,7 @@ def open(self): | |||
|
|||
self.images = self.make_data_stream('images', 'float64', self.model.focal_grid.shape, 20) | |||
|
|||
self.update_atmosphere() | |||
self.update_atmosphere |
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.
Was this change intentional? self.atmosphere
is a callable, so it usually should keep the parentheses in order to be called properly.
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.
Yes it is. Before deleting the parenthesis, I had an error TypeError: update_atmosphere() takes 1 positional argument but 2 were given
. It is the only solution I found to solve this problem.
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.
I find that weird. Let me have a look at this and I'll come back to you, because currently I can't find an explanation for this behavior.
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.
@ehpor any clue what might be happening here? @erinpougheon could you post the error message you're getting for this here please?
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.
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.
Hmmm I think you're avoiding the error, but I don't think the atmosphere works either. My intuition is that it just doesn't do anything.
If you look at the simulator.py code here, https://github.com/spacetelescope/catkit2/blob/a7c17df19636676151d965e67d0085367ba14769/catkit2/simulator/simulator.py#L131C13-L131C41, it calls the callback function with time as an argument. So it will call self.update_atmosphere(t)
, that has 2 arguments (self, and t). You would need to define def update_atmosphere(self, t)
or something like that.
Also, looking at the code, I feel the simple_simulator
on develop is bugged.
vbox_sidebar.addWidget(self.tree) | ||
|
||
# Set to values of camera | ||
self.p.param('Exposure', 'ExposureTime').setValue(self.camera.exposure_time / 1e6) |
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.
This is something I want to address, although maybe not in this PR. This is a hard-coded conversion factor for the units of the camera exposure time, which is not fantastic in the example. Could you open an issue that says: "Remove hard-coded exposure time scaling in simple camera viewer" and link it here?
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.
Here is the corresponding new issue : #228
@erinpougheon ok. Can you open an issue for this ("Update Vimba Python package installation to VimbaX" or something like that) so that we don't forget about it? |
Done, here is the new issue : #229 |
I changed everything you requested ! |
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.
One mini thing to fix, please, and the other comment is more a note to myself - consider this PR done from your side, and I will try to check why I find that one callable call weird.
@@ -20,7 +20,7 @@ def open(self): | |||
|
|||
self.images = self.make_data_stream('images', 'float64', self.model.focal_grid.shape, 20) | |||
|
|||
self.update_atmosphere() | |||
self.update_atmosphere |
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.
I find that weird. Let me have a look at this and I'll come back to you, because currently I can't find an explanation for this behavior.
While trying to figure out what is happening with the
Could you fix that one as well please? It is not used in the example you set up so we didn't notice, but since we're already on it, let's fix that one too. |
a7c17df
to
aaea162
Compare
@ivalaginja changed the simulator and optical model used in the example, so we don't have the same problem with the Now, the example is working in simulation (evn though there is no light on it, because light is not implmented in the new example of simulation). Here is the result on the simulated server: Hardware test on the THD2 testbed: Everything works as expected. I was able to have the viewer (we can see things because I turned on a laser). I could change the ROI, the gain, the exposure time etc. I think this PR is ready for final review and can be merged. I added the parenthesis back in the update_atmosphere function, in case we want it to be a separate issue. |
@property | ||
def focal_grid(self): | ||
return hcipy.make_focal_grid(12, 32) | ||
|
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.
Do you think wherever you needed the focal_grid
you could just use the detector_grid
below? I would like the grid parameters to be read from the configuration, and I was trying to call things in the detector plane (where the focal grid is) with "detector" to keep things more or less consistent.
@@ -12,7 +12,7 @@ def __init__(self): | |||
super().__init__('example_simulator') | |||
|
|||
def open(self): | |||
self.model = ExampleOpticalModel() | |||
self.model = ExampleOpticalModel(self.testbed.config) |
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.
Nice catch on this - I also think it needs to be self.testbed.config['simulator']
? Otherwise I am not sure what pool of configurations it tries to read, between all the different configuration files the example has. It might be automatically choosing the right one, but it's better to be explicit.
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.
I made it go on the simulator file in the optical model, but I can defenitly change that you're right.
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.
Good by me. Please wait with merging until we hear back from @raphaelpclt.
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.
The code looks good overall. A few things can be removed (like experiment paths in the config - catkit2 doesn't implement experiment structures). Still pending discussion on what to let public or not.
testbed_example/cli_interface.py
Outdated
Options: | ||
-p, --port PORT_ID The port number on which the testbed server operates. | ||
Defaults to the port specified in the config file. | ||
--simulated Whether the testbed server should be run in simulated mode or not. |
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.
I am not sure - shouldn't --simulated
be the default option or hardcoded? This example will never be running not simulated I guess.
926695f
to
8f235c3
Compare
8f235c3
to
fcce243
Compare
Fixes #189.
Also tried to update the link for the Allied Vision cameras in the
environment.yml
file to link it to Vimba X VmbPy library.