instamatic-dev / instamatic Goto Github PK
View Code? Open in Web Editor NEWPython program for automated electron diffraction data collection
Home Page: https://instamatic.readthedocs.io/
License: BSD 3-Clause "New" or "Revised" License
Python program for automated electron diffraction data collection
Home Page: https://instamatic.readthedocs.io/
License: BSD 3-Clause "New" or "Revised" License
Hi Stef!
I see you've been busy with instamatic. Looking forward to having a look through what is new.
These days we're trying to use the microscope remotely as much as possible. The biggest challenge right now is doing basic tuning remotely without the control panels we normally have.
Is it possible to access the multifunction knobs using the instamatic python interface? I realise that in general, instamatic and serialEM try to expose the more basic controls, but I thought I'd ask. The Multifunction knobs change purpose depending on what tools are selected in the microscope GUI.
My intention is to make a simple GUI / hotkey-controlled approach for helping with doing the basic alignment. Something also the less tech-savvy users could take advantage of. Currently we're using the following control pad simulator, which leaves some to be desired. I've sent Thermo Fisher an email about this today, but I thought I'd check in here as well.
We recently got a Merlin installed on our system (JEOL 2200). I have installed Instamatic v1.9.0 on both the Merlin PC and microscope PC. The Merlin PC does not have the TEMCOM libraries, and is disconnected from the microscope PC by default.
When running Instamatic on the Merlin PC:
If I choose JEOL as the microscope in the settings.yaml file (i.e., microscope: jeol, camera: merlin, calibration: simulate
) I get:
Config directory: C:\Users\Merlin\AppData\Roaming\instamatic\config
Microscope: jeol (server)
Starting TEM server (localhost:8088 on pid=4600)
Exception in thread None:
Traceback (most recent call last):
File "C:\Users\Merlin\AppData\Local\Programs\Python\Python38\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "C:\Users\Merlin\AppData\Local\Programs\Python\Python38\lib\site-packages\instamatic-1.9.0-py3.8.egg\instamatic\server\tem_server.py", line 46, in run
self.tem = Microscope(name=self._name, use_server=False)
File "C:\Users\Merlin\AppData\Local\Programs\Python\Python38\lib\site-packages\instamatic-1.9.0-py3.8.egg\instamatic\TEMController\microscope.py", line 55, in Microscope
tem = cls(name=name)
File "C:\Users\Merlin\AppData\Local\Programs\Python\Python38\lib\site-packages\instamatic-1.9.0-py3.8.egg\instamatic\TEMController\jeol_microscope.py", line 61, in __init__
temext = comtypes.client.GetModule(('{CE70FCE4-26D9-4BAB-9626-EC88DB7F6A0A}', 3, 0))
File "C:\Users\Merlin\AppData\Local\Programs\Python\Python38\lib\site-packages\comtypes\client\_generate.py", line 139, in GetModule
tlib = _load_tlib(tlib)
File "C:\Users\Merlin\AppData\Local\Programs\Python\Python38\lib\site-packages\comtypes\client\_generate.py", line 178, in _load_tlib
return LoadRegTypeLib(GUID(libid), *version)
File "C:\Users\Merlin\AppData\Local\Programs\Python\Python38\lib\site-packages\comtypes\typeinfo.py", line 478, in LoadRegTypeLib
_oleaut32.LoadRegTypeLib(byref(GUID(guid)), wMajorVerNum, wMinorVerNum, lcid, byref(tlib))
File "_ctypes/callproc.c", line 935, in GetResult
OSError: [WinError -2147319779] Library not registered
I figured this is because I am missing the TEMCOM library on the Merlin PC, so tried to just proceed with a simulated microscope and the Merlin camera (i.e., microscope: simulate, camera: merlin, calibration: simulate
, and I get the following:
C:\Users\JEOL>instamatic
Config directory: C:\Users\JEOL\AppData\Roaming\instamatic\config
Microscope: jeol (server)
Starting TEM server (localhost:8088 on pid=3912)
Connected to TEM server (localhost:8088)
Camera : merlin (stream)
Traceback (most recent call last):
File "c:\users\jeol\appdata\local\programs\python\python38\lib\site-packages\i
nstamatic\camera\camera_merlin.py", line 179, in establishConnection
s_cmd.connect((self.host, self.commandport))
socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\users\jeol\appdata\local\programs\python\python38\lib\runpy.py", line
194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\jeol\appdata\local\programs\python\python38\lib\runpy.py", line
87, in _run_code
exec(code, run_globals)
File "C:\Users\JEOL\AppData\Local\Programs\Python\Python38\Scripts\instamatic.
exe\__main__.py", line 7, in <module>
File "c:\users\jeol\appdata\local\programs\python\python38\lib\site-packages\i
nstamatic\main.py", line 138, in main
ctrl = TEMController.initialize(stream=True)
File "c:\users\jeol\appdata\local\programs\python\python38\lib\site-packages\i
nstamatic\TEMController\TEMController.py", line 60, in initialize
cam = Camera(cam_name, as_stream=stream, use_server=use_cam_server)
File "c:\users\jeol\appdata\local\programs\python\python38\lib\site-packages\i
nstamatic\camera\camera.py", line 67, in Camera
cam = cam_cls(name=name)
File "c:\users\jeol\appdata\local\programs\python\python38\lib\site-packages\i
nstamatic\camera\camera_merlin.py", line 54, in __init__
self.establishConnection()
File "c:\users\jeol\appdata\local\programs\python\python38\lib\site-packages\i
nstamatic\camera\camera_merlin.py", line 194, in establishConnection
raise RuntimeError(
RuntimeError: Could not establish command connection to merlin, (Merlin command
port already connected).
SUCCESS: The process with PID 2272 (child process of PID 3912) has been terminat
ed.
SUCCESS: The process with PID 3912 (child process of PID 3252) has been terminat
ed.
I couldn't quite understand what was happening with the port. It seems like there is a conflicting process, but I could not identify what that was. The application to control the Merlin was not running.
In relation to the missing TEMCOM library, I have connected the PCs via an Ethernet cable, and have tried running two instances of Instamatic but still no luck. We would appreciate any information on how to establish communication between the JEOL PC and Merlin PC!
Looks like there was one more thing needed to get the fei_microscope
working, which was adding a getMagnificationRanges
method. Currently I've just made it return an empty dict, but I'm sure there's a better return value.
Edit: In the context of the other issues, I fixed this first. I'm just reporting it last since I was able to easily bypass it.
Hi,
I have added the following microscope config as config/microscope/jeol-2100hc.yaml,
interface: jeol
ranges:
diff: [15, 20, 25, 30, 40, 50, 60, 80, 100, 120, 150, 200, 250, 300]
lowmag: [50, 60, 80, 100, 120, 150, 200, 250, 300, 400, 500, 600, 800, 1000,
1200, 1500, 2000]
mag1: [1000, 1200, 1500, 2000, 2500, 3000, 4000, 5000, 6000, 8000, 10000,
12000, 15000, 20000, 25000, 30000, 40000, 50000, 60000, 80000, 100000,
120000, 150000, 200000, 250000, 300000, 400000, 500000, 600000, 800000]
mag2: [1000, 1200, 1500, 2000, 2500, 3000, 4000, 5000, 6000, 8000, 10000,
12000, 15000, 20000, 25000, 30000, 40000, 50000, 60000, 80000, 100000,
120000, 150000, 200000, 250000, 300000, 400000, 500000, 600000, 800000]
samag: [5000, 6000, 8000, 10000, 12000, 15000, 20000, 25000, 30000, 40000,
50000, 60000, 80000, 100000, 120000, 150000, 200000, 250000, 300000,
400000]
wavelength: 0.025079
And edited config/settings.yaml such that
microscope: jeol-2100hc
camera: simulate
calibration: simulate
But the following error was raised.
例外が発生しました: ValueError
No such microscope interface: `jeol-2100hc`
File "C:\Users\JEOL\Softwares\instamatic\instamatic\TEMController\microscope.py", line 27, in get_tem
raise ValueError(f'No such microscope interface: `{interface}`')
File "C:\Users\JEOL\Softwares\instamatic\instamatic\TEMController\microscope_client.py", line 118, in _init_dict
tem = get_tem(self.name)
File "C:\Users\JEOL\Softwares\instamatic\instamatic\TEMController\microscope_client.py", line 70, in __init__
self._init_dict()
File "C:\Users\JEOL\Softwares\instamatic\instamatic\TEMController\microscope.py", line 53, in Microscope
tem = MicroscopeClient(name=name)
File "C:\Users\JEOL\Softwares\instamatic\instamatic\TEMController\TEMController.py", line 49, in initialize
tem = Microscope(tem_name, use_server=use_tem_server)
File "C:\Users\JEOL\Softwares\instamatic\instamatic\main.py", line 147, in main
ctrl = TEMController.initialize(stream=True)
File "C:\Users\JEOL\Softwares\instamatic\instamatic\main.py", line 163, in <module>
main()
I think the variable "interface" should have a value of "jeol".
Am I doing something wrong?
Thanks
Hi,
I'm interested in this software and trying to use it now,
It is very helpful for me if I can track the process step by step with VSCode python debugger, but so far with no success. (The debugger will not step-in inside TEMController.initialize())
If you know the way to use instamatic with VSCode debugger, could you please share how to do it?
Thanks
This means that the Visual C++ 2015 Redistributable package has not been installed.
It can be downloaded from:
https://www.microsoft.com/en-us/download/details.aspx?id=48145
Hi,
In line 228-229 of instamatic/docs/config.md,
**physical_pixelsize**
The physical size of a pixel in micrometer, for example: `0.055`
I think it is not 'micrometer' but 'millimeter', right?
Hi,
I have a question, to use the jeol-1400 configuration I filled the field
microscope: jeol-1400
within the settings.yaml config file but do i have to call
ctrl = TEMController.initialize(tem_name='jeol', cam_name=None)
or
ctrl = TEMController.initialize(tem_name='jeol-1400', cam_name=None)
The fact is that I observed an unexpected behaviour yesterday:
I called
ctrl = TEMController.initialize(tem_name='jeol', cam_name=None)
with
microscope: jeol-1400
within settings.yaml
but when i called
ctrl.tem.getMagnificationRanges()
I got those from jeol.yaml and not those from jeol-1400.yaml
I don't know if I am clear
Thanks
Looks like the following input code doesn't return into anything.
https://github.com/stefsmeets/instamatic/blob/688266cd61d331fd6f822b0c4606bfbf93474924/instamatic/TEMController/FEI_microscope.py#L175
For complex setups, where the camera and TEM control software are not on the same PC, it would be useful to have some documentation on how to set this up.
Hello,
We are using Instamatic v2.0.0 for doing cRED with MerlinEM detector and have discovered an issue related to the acquisition time of each frame.
For example, for an exposure time of 0,5 s for each frame (0,01 s for defocused frames), the acquisition time is typically 0,8 s (high!), which seems a bit peculiar as the readout time for the MerlinEM 24 bit data is only 1,64 ms. The rest of the time included in the definition of the acquisition time is overhead, which typically is only a few ms. Why would these extra 300 ms be added to the acquisition time and can it be corrected for? After what I've understood, this is not an issue for other detectors.
I came across the note on using Instamatic with Merlin that said: "Changing exposure on the fly (for example, in the gui) incurs a small overhead (~300 ms). "
This overhead (of 300 ms) is in fact not small when doing cRED for 3D ED data acquisition, and is seemingly added without us doing any changes on the exposure time in the GUI. If the reason for the added time in fact is overhead, is there any way to avoid it?
The portable version is difficult to maintain. Recommend to use the python installation via pip.
Hi,
I had a question while I was reading the CamClient class code.
CamClient.init_attr_dict() method is defined as follows,
I am curious where get_attrs() method is defined for CamClient class.
This link suggests that instamatic browser is a program for indexing electron diffraction patterns.
The command is given as this:
instamatic.browser images/*.tiff -r results.csv
Is there an example indexing an electron diffraction or finding the zone axis of a diffraction pattern based on a known crystal structure?
Hi everybody,
I've just installed instamatic via pip install instamatic
I tried to run this short code:
from instamatic import TEMController
ctrl = TEMController.initialize()
but I got this error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\AppData\Local\Programs\Python\Python38-32\lib\site-packages\instamatic\TEMController\TEMController.py", line 66, in initialize
ctrl = _ctrl = TEMController(tem=tem, cam=cam)
File "C:\Users\AppData\Local\Programs\Python\Python38-32\lib\site-packages\instamatic\TEMController\TEMController.py", line 121, in __init__
print(self)
File "C:\Users\AppData\Local\Programs\Python\Python38-32\lib\site-packages\instamatic\TEMController\TEMController.py", line 125, in __repr__
return (f'Mode: {self.tem.getFunctionMode()}\n'
File "C:\Users\AppData\Local\Programs\Python\Python38-32\lib\site-packages\instamatic\TEMController\microscope_client.py", line 92, in wrapper
return self._eval_dct(dct)
File "C:\Users\AppData\Local\Programs\Python\Python38-32\lib\site-packages\instamatic\TEMController\microscope_client.py", line 106, in _eval_dct
if status == 200:
UnboundLocalError: local variable 'status' referenced before assignment
Could you help me to solve it, please?
Thank you
Regards
I'm following config.md
to set up instamatic to talk to our Titan. I did the following to set up my Anaconda environment on the offline Titan computer:
py3
and installed all the dependencies needed for instamatic through conda/pip*, but not instamatic itself. (I originally did install instamatic but on the Titan I got a path error from the instamatic
script due to different user names on the Windows user)$HOME\Anaconda3\envs\py3
from the online PC to the Titan PC.pip install -e .
on a unzipped copy of instamatic-master on the Titan PC. This way I can modify instamatic from a more accessible folder.instamatic
(from cmd) twice the first time its used - the first time it creates a certain file but then raises an error. On the second time it runs smoothly and opens a simulated environment GUI with a high fps screen.instamatic.autoconfig.exe
but end up with the following error.txt.We have two Ultrascan cameras on our system (models US1000XP and US1000FTXP). They are identical cameras with different shutters. Is there any hope of adding support for those?
We do have an Orius camera on our JEOL2100F, but that's of slightly less interest to me.
This afternoon I attempted to set up insteaDMatic to acquire a rotation series in DM, using instamatic to control the tilt. InsteaDMatic on its own works well, but I'm having trouble with the instamatic.temserver_fei
communciation. I get the following error when I click "Start" in DM.
To clarify: GMS is installed on the FEI Titan PC, which also has instamatic on it.
Error (The exception occurs when I click "Start" in GMS):
(py3) C:\Users\supervisor\Documents\instamatic-master>instamatic.temserver_fei
Config directory: C:\Users\supervisor\AppData\Roaming\instamatic\config
Microscope: fei (server)
Starting TEM server (localhost:8088 on pid=11224)
Please select the type of sample stage before moving on.
Press <ENTER> to continue...Connected to TEM server (localhost:8088)
Camera : gatan (stream)
Exception in thread Thread-3:
Traceback (most recent call last):
File "C:\Users\supervisor\Anaconda3\envs\py3\lib\threading.py", line 917, in _
bootstrap_inner
self.run()
File "C:\Users\supervisor\Anaconda3\envs\py3\lib\threading.py", line 865, in r
un
self._target(*self._args, **self._kwargs)
File "c:\users\supervisor\documents\instamatic-master\instamatic\server\tem_se
rver.py", line 87, in handle
data = pickle.loads(data)
_pickle.UnpicklingError: unpickling stack underflow
I'm currently investigating, I believe it has to do with the buffer size in It didn't.tem_server.py
The issue, was my misunderstanding what the use_tem_server and use_cam_server options in settings.yaml meant. I dare say that other people may run into the same issue, and that perhaps an update of the instructions on the website could be useful. Specifically, the website could emphasize the need to run instamatic.temserver prior to running instamatic when using a multi-PC setup. It is easy to mistakenly assume the tem_server and cam_server options talk about TEM External Server from JEOL, and Serval from ASI, respectively.
instamatic.autoconfig
Hi again,
sorry for disturbing but I am facing a new issue I cannot solve, I tried to use goniotool.py but I am stuck at the importing step
from pywinauto import Application
I get this error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\RDS\AppData\Local\Programs\Python\Python38\lib\site-packages\pywinauto\__init__.py", line 59, in <module>
import win32api # noqa: E402
ImportError: DLL load failed while importing win32api: %1 n’est pas une application Win32 valide.
Here is the python version I am using:
Python 3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:52:53) [MSC v.1927 64 bit (AMD64)] on win32
Instamatic 1.6.0
If you could help me to solve this problem I would be very thankful!
Regards
Hi,
I have noticed that config.calibration.pixelsize_diff is not accessible after importing instamatic.config.
Accessing config.calibration.pixelsize_diff
throws an exception AttributeError: 'ConfigObject' object has no attribute 'pixelsize_diff'
.
Is this an expected behavior?
I'm using commit fa6af76 in the sumulation mode.
And could you please show me in which code the attribute pixelsize_diff is defined?
Sorry I'm asking you many times these days.
Thanks!
Issue:
raise ValueError(f'No such microscope interface: `{interface}`')
ValueError: No such microscope interface: `jeol_tem`
Assumption:
Despite the fact that the jeol_tem.yaml
file does have the line ‘interface: jeol’, it falls back to the file name?
Workaround:
Rename the .yaml
to jeol.yaml
Thanks @danielnrainer
Hi Stef,
I'm installing instamatic to test on our Titan G2 60-300 here in Oslo (in an anaconda environment).
In addition to performing some electron diffraction experiments, I was hoping to take advantage of the programmatic control of the microscope to acquire EELS spectra. Not spectrum images directly, but eels spectra as a function of shifting the diffraction pattern over the GIF. Is there any way to do that with instamatic in its current form?
I'm super impressed with the software, btw. We had a demo by Hongyi Xu last week.
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.
Hi Stef,
I am playing with some features in instamatic under simulation mode.
After I used RED data collection, an error occurred:
Traceback (most recent call last):
File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\tkinter\__init__.py", line 1705, in __call__
return self.func(*args)
File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\tkinter\__init__.py", line 3442, in __call__
self.__callback(self.__value, *args)
File "D:\TEM_Automation\repository\instamatic\instamatic\gui\ctrl_frame.py", line 163, in set_mode
self.ctrl.mode.set(self.var_mode.get())
AttributeError: 'str' object has no attribute 'set'
I found that in instamatic/experiments/red/experiment.py
if image_mode != 'diff':
ctrl.mode = image_mode
should be changed to:
if image_mode != 'diff':
ctrl.mode.set(image_mode)
Hello,
I am getting the following error after running Instamatic on a Merlin detector for a short time ( < 5 minutes).
Exception in thread Thread-2:
Traceback (most recent call last):
File "c:\users\merlin\appdata\local\programs\python\python38\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "c:\users\merlin\appdata\local\programs\python\python38\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "c:\users\merlin\appdata\local\programs\python\python38\lib\site-packages\instamatic\camera\videostream.py", line 56, in run
frame = self.cam.getImage(exposure=self.frametime, binsize=self.binsize)
File "c:\users\merlin\appdata\local\programs\python\python38\lib\site-packages\instamatic\camera\camera_merlin.py", line 196, in getImage
framedata = self.receive_data(nbytes=self._frame_length)
File "c:\users\merlin\appdata\local\programs\python\python38\lib\site-packages\instamatic\camera\camera_merlin.py", line 86, in receive_data
data.extend(self.s_data.recv(nbytes - len(data)))
socket.timeout: timed out
We're planning on starting to utilize Instamatic for automating parts of our TEM workflows, which includes MerlinEM detectors. So at some point in the future (not sure exactly when) we'll have a pull request which includes remote control of the Quantum Detector MerlinEM detectors via the TCP/IP API.
This will most likely be via incorporating the code from my old library Merlin Interface, which I can relicense to work with Instamatic's license.
At first this will most likely be just the control part, without getting data.
Looks like diffshift is limited to between -1 and 1 unnecessarily. I disabled the check on our Titan, and it happily goes much further out.
https://github.com/stefsmeets/instamatic/blob/e3b091bba82b53e84ac0e9ec5b14ede731a72335/instamatic/TEMController/fei_microscope.py#L462
Also, how come the FEI diffshift uses radian units? @asdfdsa Not complaining, just curious.
https://github.com/stefsmeets/instamatic/blob/e3b091bba82b53e84ac0e9ec5b14ede731a72335/instamatic/TEMController/fei_microscope.py#L467
I believe the autoconfig asks the same question and offers the same choices no matter what :)
Compare with line 79, 85 and 95.
https://github.com/stefsmeets/instamatic/blob/521dd661d99e7ca09fae07bc22f37f993dcbc896/instamatic/config/autoconfig.py#L49
The documentation could be improved to add this information.
i.e.
To work with the gatan camera,
For this, instamatic depends on the RED CCD Plugin. You can download it here.
The plugin can be found in the package REDc.rar
, in .\CCD_plugins\Gatan\Normal Gatan cameras\REDCCDPlugin
.
Place REDCCDPlugin.dll in your Gatan plugin directory, which can usually be found here: C:\Program files\Gatan\DigitalMicrgraph\Plugins
. For more information, have a look at the RED installation instructions manual.
I don't think this was posted before, but the weights-py3.p file was missing when I pip installed Instamatic. This prevents data acquisition: on attempting to collect data, the following error is returned:
**Traceback (most recent call last):
File "c:\python36\lib\site-packages\instamatic\gui\gui.py", line 71, in run
func(self, kwargs)
File "c:\python36\lib\site-packages\instamatic\gui\red_frame.py", line 110, in acquire_data_RED
from instamatic.experiments import RED
File "c:\python36\lib\site-packages\instamatic\experiments_init_.py", line 1, in
from .autocred import experiment as autocRED
File "c:\python36\lib\site-packages\instamatic\experiments\autocred\experiment.py", line 29, in
from instamatic.neural_network import predict, preprocess
File "c:\python36\lib\site-packages\instamatic\neural_network_init_.py", line 1, in
from .neural_network import predict
File "c:\python36\lib\site-packages\instamatic\neural_network\neural_network.py", line 6, in
with open(Path(file).parent / 'weights-py3.p', 'rb') as p_file:
FileNotFoundError: [Errno 2] No such file or directory: 'c:\python36\lib\site-packages\instamatic\neural_network\weights-py3.p'
Not sure why this file is not downloaded with the package but it can be found here. So, a simple fix is to download the weights-py3.p file and put it in the appropriate folder.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.