Closed GearoidM closed 1 year ago
could this be somewhat related to #42 ? Actually I don't know of the top of my head if we're still running it with the workaround mentioned in the open issue on our setup (Jeol NeoARM 200F + TVIPS XF416), but I can/will check tomorrow.
Thanks for the super detailed bug report!
shared_memory
is only supported from Python 3.8 onwards:
https://docs.python.org/3/library/multiprocessing.shared_memory.html
You can turn that off in the config: cam_use_shared_memory: False
(see [https://instamatic.readthedocs.io/en/latest/config.html](the documentation here) for more info)
Can you let me know if this works?
Otherwise, can you try with use_tem_server: False
and use_cam_server: False
? This will make it a bit easier to debug. If you set either of these to true, instamatic will start a second instamatic process that is responsible for just the communication to the camera or microscope.
I will also try to reproduce your issue here and get back to you.
As a side note: I normally recommend running instamatic.temserver
in a separate command prompt to isolate the tem communication. Instamatic will then connect to this server automatically use_tem_server: True
.
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 Server listening on localhost:8088 GonioToolClient: [WinError 10061] No connection could be made because the target machine actively refused it Could not connect to GonioToolServer, goniotool unavailable! Initialized connection to microscope: jeol Connected by ('127.0.0.1', 49284)
After running cRED:
Output directory: C:\instamatic\2023-05-17\experiment_4 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**
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 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 251, in start_collection if self.ctrl.mode != 'diff': File "C:\Users\VALUEDGATANCUSTOMER.GATANCUSTOMER\AppData\Local\Programs\Python\Python36\lib\site-packages\instamatic-1.8.0-py3.6.egg\instamatic\TEMController\states.py", line 19, in eq return self.state == other File "C:\Users\VALUEDGATANCUSTOMER.GATANCUSTOMER\AppData\Local\Programs\Python\Python36\lib\site-packages\instamatic-1.8.0-py3.6.egg\instamatic\TEMController\states.py", line 79, in state return self.get() File "C:\Users\VALUEDGATANCUSTOMER.GATANCUSTOMER\AppData\Local\Programs\Python\Python36\lib\site-packages\instamatic-1.8.0-py3.6.egg\instamatic\TEMController\states.py", line 87, in get return self._getter() File "C:\Users\VALUEDGATANCUSTOMER.GATANCUSTOMER\AppData\Local\Programs\Python\Python36\lib\site-packages\instamatic-1.8.0-py3.6.egg\instamatic\TEMController\jeol_microscope.py", line 386, in getFunctionMode mode, name, result = self.eos3.GetFunctionMode() _ctypes.COMError: (-2147417842, 'The application called an interface that was marshalled for a different thread.', (None, None, None, 0, None))**
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
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 262, in start_collection
self.ctrl.cam.block()
File "C:\Users\VALUEDGATANCUSTOMER.GATANCUSTOMER\AppData\Local\Programs\Python\Python36\lib\site-packages\instamatic-1.8.0-py3.6.egg\instamatic\camera\camera_client.py", line 110, in getattr
raise AttributeError(f'{self.__class__.__name__}
object has no attribute {attr_name}
')
AttributeError: CamClient
object has no attribute block
**
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:
mode, name, result = self.eos3.GetFunctionMode()
_ctypes.COMError: (-2147417842, 'The application called an interface that was marshalled for a different thread.', (None, None, None, 0, None))
NameError: name 'TEMValueError' is not defined
. Instead it should have reported the error in (1) here, I will have a look at this. -> I have fixed the error, but this won't resolve your problem. You will need to define your camera lengths in the config. See the documentation here for how to do that.Other:
Which camera are you trying to use? Instamatic does not support running cred on cameras over a socket, which is why you get AttributeError: CamClient object has no attribute block
. I have updated the error message to make this more clear.
Is there a reason you want to use the camera server? This is only necessary for cameras which work via the COM interface (e.g. TVIPS), which will give issues if it is not in the main thread in some configurations. The cam server helps isolate the camera process. Or if you want to access the camera over the network.
Can you set use_goniotool: False
? I don't recommend that you use this, unless you know what you are doing. Since the interface is not running, it may interfere with how instamatic works.
My recommendation: use_tem_server: True
, use_cam_server: False
, use_goniotool: False
.
Todo:
self.block
/ cred error in camera: simulate
-> Instamatic does not support cameras which are connected over a socket to be streamed, and can therefore not be used with cred currently.Alright, I fixed some of the errors in the latest version. I have pushed a new release (1.9.0) that you can try: pip install -U instamatic
.
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:
**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\server\tem_server.py", line 60, in run
ret = self.evaluate(func_name, args, kwargs)
File "C:\Users\VALUEDGATANCUSTOMER.GATANCUSTOMER\AppData\Local\Programs\Python\Python36\lib\site-packages\instamatic-1.8.0-py3.6.egg\instamatic\server\tem_server.py", line 79, in evaluate
ret = f(*args, **kwargs)
File "C:\Users\VALUEDGATANCUSTOMER.GATANCUSTOMER\AppData\Local\Programs\Python\Python36\lib\site-packages\instamatic-1.8.0-py3.6.egg\instamatic\TEMController\jeol_microscope.py", line 185, in setMagnification
raise TEMValueError(f'No such camera length or magnification: {value}') from None
NameError: name 'TEMValueError' is not defined
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**
The error I am getting in version 1.9.0:
_Data Recording started.
Traceback (most recent call last):
File "C:\Users\VALUEDGATANCUSTOMER.GATANCUSTOMER\AppData\Local\Programs\Python\Python36\lib\site-packages\instamatic-1.9.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.9.0-py3.6.egg\instamatic\gui\cred_frame.py", line 212, in acquire_data_cRED
success = cexp.start_collection()
File "C:\Users\VALUEDGATANCUSTOMER.GATANCUSTOMER\AppData\Local\Programs\Python\Python36\lib\site-packages\instamatic-1.9.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.9.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.9.0-py3.6.egg\instamatic\TEMController\microscope_client.py", line 88, in wrapper
return self._eval_dct(dct)
File "C:\Users\VALUEDGATANCUSTOMER.GATANCUSTOMER\AppData\Local\Programs\Python\Python36\lib\site-packages\instamatic-1.9.0-py3.6.egg\instamatic\TEMController\microscope_client.py", line 106, in _eval_dct
raise exception_list.get(error_code, TEMCommunicationError)(*args)
instamatic.exceptions.TEMValueError: No such camera length or magnification: 300_
The config for both is:
microscope: jeol
camera: simulate
calibration: simulate
#Global toggle to force simulated camera/microscope interface
simulate: False
data_directory: C:/instamatic
#flatfield: C:/instamatic/flatfield.tiff
flatfield:
#Run the TEM connection in a different process (recommended)
use_tem_server: True
tem_server_host: 'localhost'
tem_server_port: 8088
tem_require_admin: False
tem_communication_protocol: 'pickle' # pickle, json, msgpack, yaml
#Run the Camera connection in a different process
use_cam_server: False
cam_server_host: 'localhost'
cam_server_port: 8087
cam_use_shared_memory: False
#Submit collected data to an indexing server (CRED only)
use_indexing_server_exe: False
indexing_server_exe: 'instamatic.dialsserver.exe'
indexing_server_host: 'localhost'
indexing_server_port: 8089
dials_script: 'E:/cctbx/dials_script.bat'
#JEOL only, automatically set the rotation speed via Goniotool (instamatic.goniotool)
use_goniotool: False
goniotool_server_host: 'localhost'
goniotool_server_port: 8090
#For InsteaDMatic to control the rotation speed on a FEI/TFS system
fei_server_host: '192.168.12.1'
fei_server_port: 8091
#Automatically submit the data to an indexing server running in a VM (VirtualBox)
use_VM_server_exe: False
VM_server_exe: 'instamatic.VMserver.exe'
VM_server_host: 'localhost'
VM_server_port: 8092
VM_ID: "Ubuntu 14.04.3"
VM_USERNAME: "lab6"
VM_PWD: "testtest"
VM_STARTUP_DELAY: 50
VM_DESKTOP_DELAY: 20
VM_SHARED_FOLDER: F:\SharedWithVM
# Testing variables
cred_relax_beam_before_experiment: false
cred_track_stage_positions: false
# Here the panels for the GUI can be turned on/off/reordered
modules:
- 'cred'
- 'cred_tvips'
- 'cred_fei'
- 'sed'
- 'autocred'
- 'red'
- 'machine_learning'
- 'ctrl'
- 'debug'
- 'about'
- 'console'
- 'io'
Here is the calibration file (output from running instamatic.autoconfig.exe; I replaced the old simulate.yaml with this one):
name: jeol
mag1:
pixelsize:
1500: 1.0
2000: 1.0
2500: 1.0
3000: 1.0
4000: 1.0
5000: 1.0
6000: 1.0
8000: 1.0
10000: 1.0
12000: 1.0
15000: 1.0
20000: 1.0
25000: 1.0
30000: 1.0
40000: 1.0
50000: 1.0
60000: 1.0
80000: 1.0
100000: 1.0
120000: 1.0
150000: 1.0
200000: 1.0
250000: 1.0
300000: 1.0
400000: 1.0
500000: 1.0
600000: 1.0
800000: 1.0
1000000: 1.0
stagematrix:
1500: [1, 0, 0, 1]
2000: [1, 0, 0, 1]
2500: [1, 0, 0, 1]
3000: [1, 0, 0, 1]
4000: [1, 0, 0, 1]
5000: [1, 0, 0, 1]
6000: [1, 0, 0, 1]
8000: [1, 0, 0, 1]
10000: [1, 0, 0, 1]
12000: [1, 0, 0, 1]
15000: [1, 0, 0, 1]
20000: [1, 0, 0, 1]
25000: [1, 0, 0, 1]
30000: [1, 0, 0, 1]
40000: [1, 0, 0, 1]
50000: [1, 0, 0, 1]
60000: [1, 0, 0, 1]
80000: [1, 0, 0, 1]
100000: [1, 0, 0, 1]
120000: [1, 0, 0, 1]
150000: [1, 0, 0, 1]
200000: [1, 0, 0, 1]
250000: [1, 0, 0, 1]
300000: [1, 0, 0, 1]
400000: [1, 0, 0, 1]
500000: [1, 0, 0, 1]
600000: [1, 0, 0, 1]
800000: [1, 0, 0, 1]
1000000: [1, 0, 0, 1]
mag2:
pixelsize:
1500: 1.0
2000: 1.0
2500: 1.0
3000: 1.0
4000: 1.0
5000: 1.0
6000: 1.0
8000: 1.0
10000: 1.0
12000: 1.0
15000: 1.0
20000: 1.0
25000: 1.0
30000: 1.0
40000: 1.0
50000: 1.0
60000: 1.0
80000: 1.0
100000: 1.0
120000: 1.0
150000: 1.0
200000: 1.0
250000: 1.0
300000: 1.0
400000: 1.0
500000: 1.0
600000: 1.0
800000: 1.0
1000000: 1.0
stagematrix:
1500: [1, 0, 0, 1]
2000: [1, 0, 0, 1]
2500: [1, 0, 0, 1]
3000: [1, 0, 0, 1]
4000: [1, 0, 0, 1]
5000: [1, 0, 0, 1]
6000: [1, 0, 0, 1]
8000: [1, 0, 0, 1]
10000: [1, 0, 0, 1]
12000: [1, 0, 0, 1]
15000: [1, 0, 0, 1]
20000: [1, 0, 0, 1]
25000: [1, 0, 0, 1]
30000: [1, 0, 0, 1]
40000: [1, 0, 0, 1]
50000: [1, 0, 0, 1]
60000: [1, 0, 0, 1]
80000: [1, 0, 0, 1]
100000: [1, 0, 0, 1]
120000: [1, 0, 0, 1]
150000: [1, 0, 0, 1]
200000: [1, 0, 0, 1]
250000: [1, 0, 0, 1]
300000: [1, 0, 0, 1]
400000: [1, 0, 0, 1]
500000: [1, 0, 0, 1]
600000: [1, 0, 0, 1]
800000: [1, 0, 0, 1]
1000000: [1, 0, 0, 1]
lowmag:
pixelsize:
50: 1.0
60: 1.0
80: 1.0
100: 1.0
120: 1.0
150: 1.0
200: 1.0
250: 1.0
300: 1.0
400: 1.0
500: 1.0
600: 1.0
800: 1.0
1000: 1.0
1200: 1.0
1500: 1.0
stagematrix:
50: [1, 0, 0, 1]
60: [1, 0, 0, 1]
80: [1, 0, 0, 1]
100: [1, 0, 0, 1]
120: [1, 0, 0, 1]
150: [1, 0, 0, 1]
200: [1, 0, 0, 1]
250: [1, 0, 0, 1]
300: [1, 0, 0, 1]
400: [1, 0, 0, 1]
500: [1, 0, 0, 1]
600: [1, 0, 0, 1]
800: [1, 0, 0, 1]
1000: [1, 0, 0, 1]
1200: [1, 0, 0, 1]
1500: [1, 0, 0, 1]
samag:
pixelsize:
8000: 1.0
10000: 1.0
12000: 1.0
15000: 1.0
20000: 1.0
25000: 1.0
30000: 1.0
40000: 1.0
50000: 1.0
60000: 1.0
80000: 1.0
100000: 1.0
120000: 1.0
150000: 1.0
200000: 1.0
250000: 1.0
300000: 1.0
400000: 1.0
500000: 1.0
600000: 1.0
stagematrix:
8000: [1, 0, 0, 1]
10000: [1, 0, 0, 1]
12000: [1, 0, 0, 1]
15000: [1, 0, 0, 1]
20000: [1, 0, 0, 1]
25000: [1, 0, 0, 1]
30000: [1, 0, 0, 1]
40000: [1, 0, 0, 1]
50000: [1, 0, 0, 1]
60000: [1, 0, 0, 1]
80000: [1, 0, 0, 1]
100000: [1, 0, 0, 1]
120000: [1, 0, 0, 1]
150000: [1, 0, 0, 1]
200000: [1, 0, 0, 1]
250000: [1, 0, 0, 1]
300000: [1, 0, 0, 1]
400000: [1, 0, 0, 1]
500000: [1, 0, 0, 1]
600000: [1, 0, 0, 1]
diff:
pixelsize:
20: 1.0
25: 1.0
30: 1.0
40: 1.0
50: 1.0
60: 1.0
80: 1.0
100: 1.0
120: 1.0
150: 1.0
200: 1.0
stagematrix:
20: [1, 0, 0, 1]
25: [1, 0, 0, 1]
30: [1, 0, 0, 1]
40: [1, 0, 0, 1]
50: [1, 0, 0, 1]
60: [1, 0, 0, 1]
80: [1, 0, 0, 1]
100: [1, 0, 0, 1]
120: [1, 0, 0, 1]
150: [1, 0, 0, 1]
200: [1, 0, 0, 1]
Do you also have a microscope file (microscope.yaml
or jeol.yaml
) in your config directory? It will be in the microscope
directory. You can find your config directory by typing instamatic -o config
.
For more info, see here: https://instamatic.readthedocs.io/en/latest/config.html#microscope-yaml
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.