-
Notifications
You must be signed in to change notification settings - Fork 30
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
Issues with CRED, Instamatic v1.8.0 #64
Comments
could this be somewhat related to #42 ? |
Thanks for the super detailed bug report!
You can turn that off in the config: Can you let me know if this works? Otherwise, can you try with I will also try to reproduce your issue here and get back to you. As a side note: I normally recommend running |
Thanks for checking, @danielnrainer. The instamatic.autoconfig.exe does not seem to write anything in its current state. I think this is because of how the paths are defined in autoconfig.py. But, anyway, there was no new jeol_tem.yaml output file to rename. Instead, as suggested in the documentations I just edited the jeol.yaml file that was already there. @stefsmeets, No problem! Yes, I see that shared_memory is only supported from Python 3.8+. I cannot update Windows on the microscope/camera PCs because it could interfere with other components of the system. I will test Instamatic on the Merlin PC when it is installed. Attempt 1: I set cam_use_shared_memory: False. I set use_tem_server: True and use_cam_server: False (these settings are consistent with previous attempts to run cRED). I ran instamatic.temserver in a command prompt and then instamatic in another. The output of the prompt with instamatic.temserver is: Config directory: C:\Users\VALUEDGATANCUSTOMER.GATANCUSTOMER\AppData\Roaming\instamatic\config After running cRED: **Output directory: C:\instamatic\2023-05-17\experiment_4 Attempt 2: I also tried the same settings as above without running instamatic.temserver, and got the same error. Attempt 3: Running instamatic.temserver, then instamatic. And setting use_tem_server: True and use_cam_server: False and cam_use_shared_memory: True (note this difference to attempt 1), the outputs in the instamatic.temserver command prompt is the same as described above. Similarly for when running cRED, the rcommand prompt output is the same as above. Attempt 4: Running instamatic.temserver, then instamatic. And setting use_tem_server: False and use_cam_server: False and cam_use_shared_memory: true. The output for instamatic.temserver is the same as before. The output after running cRED: **Output directory: C:\instamatic\2023-05-17\experiment_7 Attempt 5: Running instamatic.temserver, then instamatic. And setting use_tem_server: True and use_cam_server: True and cam_use_shared_memory: False. **Output directory: C:\instamatic\2023-05-17\experiment_9 Attempt 6: Running instamatic.temserver, then instamatic. And setting use_tem_server: False and use_cam_server: False and cam_use_shared_memory: False. I am pretty sure I tried this combination but do not have an output recorded. I will test this again another time. |
Alright, thanks! Seems like there are 2 things going on:
Other:
My recommendation: |
Todo:
|
Alright, I fixed some of the errors in the latest version. I have pushed a new release (1.9.0) that you can try: |
I defined the camera lengths in the config file, and can get RED to run. Previously, when it was incorrectly defined, neither RED or cRED worked. Since RED at least works now, I think I did that correctly. I will double check the config files, though. At the moment, I am just trying to use the simulated camera, with simulate.yaml. Does the simulated camera simulate communication over a socket? Not sure if that is possible, but I guess it would explain why RED works and not cRED. We would like to perform experiments with the Merlin in the future, but I was just testing Instamatic with the simulate camera until we get it. No reason to use the cam_server, given the information above. I will use your recommendations next time: use_tem_server: True, use_cam_server: False, use_goniotool: False. Anyway, thank you for the prompt support! I appreciate it. |
The simulated camera is just a noise generator with the given dimensions in the config, nothing more. It should not crash with cred. What is the error you are getting? Could you post your config? |
Apologies for the delayed response. The following errors are from running Instamatic from the Gatan PC. I have since installed Instamatic 1.9.0 on the microscope PC and cRED seems to work fine with the simulated detector. The error I am getting for version 1.8.0:
The error I am getting in version 1.9.0:
The config for both is:
Here is the calibration file (output from running instamatic.autoconfig.exe; I replaced the old simulate.yaml with this one):
|
Do you also have a microscope file ( For more info, see here: |
I am going to close this issue, because I believe this has been resolved based on our email conversations. Feel free to re-open if you run into any other issues. |
Dear @stefsmeets and community,
I am having trouble running CRED with the GUI. I am using a JEOL-2200FS with a simulated detector. The microscope and camera PCs are running WIndows 7 Professional and Windows Server 2008 R2 Standard. I am running Python 3.6.8. I have installed Instamatic on the camera PC and run Instamatic via start_Cmder.exe. I tested out instamatic.autoconfig.exe and I do not think it is working as intended. That is, the output paths seems to be incorrect; see the following output from running instamatic.autoconfig.exe:
Wrote files config files:
Copy jeol_tem.yaml ->
C:\Users\VALUEDGATANCUSTOMER.GATANCUSTOMER\AppData\Roaming\instamatic\config\calibration\simulate.yaml\jeol_tem.yaml
Copy jeol_calib.yaml ->
C:\Users\VALUEDGATANCUSTOMER.GATANCUSTOMER\AppData\Roaming\instamatic\config\microscope\jeol.yaml\jeol_calib.yaml
Copy simulate_cam.yaml ->
C:\Users\VALUEDGATANCUSTOMER.GATANCUSTOMER\AppData\Roaming\instamatic\alignments\simulate_cam.yaml
I think that running instamatic.autoconfig.exe should write the jeol_tem.yaml file to the ...\calibration directory, where here it seems to be trying to write it to the ...\calibration\simulate.yaml directory, which does not make sense to me. Similarly, for the microscope configuration files.
I tried correcting the code myself on a personal computer (with a simulated microscope and camera), and got it to overwrite the files, but have not had a chance to test that on the real system. Instead, I just manually edited the config files with the correct settings.
Next, I ran instamatic to open the GUI to run some experiments. I tested both RED and cRED. RED seems to work fine now that I have correctly updated the config files (previously, I had a KeyError because the available camera lengths did not match those in the config files). Unfortunately, cRED does not work as desired. With cRED, I click the start data collection button, start rotation by holding the alpha tilt button, then I click the stop data collection button and release the alpha tilt button. The camera length and rotation angle change after a very brief computer stutter; the data will not be written to file, instead I get NameError: name 'TEMValueError' is not defined. For example, I was working at a camera length of 200 cm and started rotation from zero and ended at 10 degrees. After data collection and rotation stopped, the camera length changed to 40 cm. Rotation changed to 41 degrees.
I tried to just choose 40 cm, which is also in the config files. This time, the camera length changed to 50 cm, and angle changed to 41 degrees again. Each time, I get the NameError. Full output below:
**Is VM server running? Connection failed.
Output directory: C:\instamatic\2023-05-16\experiment_5
Data Recording started.
Traceback (most recent call last):
File "C:\Users\VALUEDGATANCUSTOMER.GATANCUSTOMER\AppData\Local\Programs\Python\Python36\lib\site-packages\instamatic-1.8.0-py3.6.egg\instamatic\gui\gui.py", line 71, in run
func(self, *kwargs)
File "C:\Users\VALUEDGATANCUSTOMER.GATANCUSTOMER\AppData\Local\Programs\Python\Python36\lib\site-packages\instamatic-1.8.0-py3.6.egg\instamatic\gui\cred_frame.py", line 211, in acquire_data_cRED
success = cexp.start_collection()
File "C:\Users\VALUEDGATANCUSTOMER.GATANCUSTOMER\AppData\Local\Programs\Python\Python36\lib\site-packages\instamatic-1.8.0-py3.6.egg\instamatic\experiments\cred\experiment.py", line 315, in start_collection
self.ctrl.magnification.set(300)
File "C:\Users\VALUEDGATANCUSTOMER.GATANCUSTOMER\AppData\Local\Programs\Python\Python36\lib\site-packages\instamatic-1.8.0-py3.6.egg\instamatic\TEMController\lenses.py", line 24, in set
self._setter(value)
File "C:\Users\VALUEDGATANCUSTOMER.GATANCUSTOMER\AppData\Local\Programs\Python\Python36\lib\site-packages\instamatic-1.8.0-py3.6.egg\instamatic\TEMController\microscope_client.py", line 92, in wrapper
return self._eval_dct(dct)
File "C:\Users\VALUEDGATANCUSTOMER.GATANCUSTOMER\AppData\Local\Programs\Python\Python36\lib\site-packages\instamatic-1.8.0-py3.6.egg\instamatic\TEMController\microscope_client.py", line 111, in _eval_dct
raise exception_list.get(error_code, TEMCommunicationError)(args)
NameError: name 'TEMValueError' is not defined
As mentioned RED works fine with the config files: it does not change the camera length or alpha position, and Instamatic writes the images to file when running in this mode. Has anybody experienced these issues? I haven't looked into it in great detail but the TEMCommunicationError (obviously) suggests that there is a problem with communication between the camera and microscope PCs. Perhaps continuous readout is causing some communication issues associated with timeout. Is this problem perhaps because I am not running the temserver and camsever in separate terminal windows? I tried setting this up by editing the settings.yaml, i.e., setting use_cam_server: True and use_tem_server: True. Unfortunately, I am using Python 3.6, which does not have shared_memory; see error below:
Traceback (most recent call last):
File "c:\python36\lib\runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "c:\python36\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Python36\Scripts\instamatic.exe_main.py", line 7, in
File "c:\python36\lib\site-packages\instamatic\main.py", line 138, in main
ctrl = TEMController.initialize(stream=True)
File "c:\python36\lib\site-packages\instamatic\TEMController\TEMController.py", line 61, in initialize
cam = Camera(cam_name, as_stream=stream, use_server=use_cam_server)
File "c:\python36\lib\site-packages\instamatic\camera\camera.py", line 51, in Camera
from instamatic.camera.camera_client import CamClient
File "c:\python36\lib\site-packages\instamatic\camera\camera_client.py", line 17, in
from multiprocessing import shared_memory
ImportError: cannot import name 'shared_memory'
SUCCESS: The process with PID 16572 (child process of PID 6020) has been terminated.
SUCCESS: The process with PID 6020 (child process of PID 7916) has been terminated.
I tested 3.8.9 on my personal PC and can run Instamatic with both use_cam_server: True and use_tem_server: True. I cannot use Python 3.8.9 on the camera PC because Windows needs some updates, but its offline status makes updating this somewhat more difficult. I will try to update and run Instamatic with Python 3.8.9 instead.
The text was updated successfully, but these errors were encountered: