instamatic-dev / instamatic

Python program for automated electron diffraction data collection
https://instamatic.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
57 stars 25 forks source link

Installing Instamatic on an FEI Titan G2 #18

Closed thomasaarholt closed 4 years ago

thomasaarholt commented 4 years ago

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:

Setup

Launching Instamatic

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.

thomasaarholt commented 4 years ago

I should mention - I did try to choose the Orius camera. Then there's a blank Windows popup dialogue that appears followed by the error in error2.txt.

thomasaarholt commented 4 years ago

Okay, so I've realised that I should probably just skip the autoconfig, since I now see that templates for things like the fei microscope are actually named fei_themisz. [1 min later]: Hehe, I think I just got it to work, will report some errors in separate issue. Edit: See #19

thomasaarholt commented 4 years ago

Current issue: The fei_microscope doesn't have a getCurrentDensity method. I can create a dummy pass method for now and see if that works, but I suspect there'll be a few more of the same sort. Could you take a look? I need to pass on the microscope to the next user now, but I'll be back on tomorrow morning. (CET timezone here)

stefsmeets commented 4 years ago

Could you take a look?

Yeah, I will do so tomorrow. I added the current density recently and didn't think to add it to the FEI interface.

The error you are getting is because are probably missing the DM plugin. I'm using the one from RED, you can get it from here: https://zenodo.org/record/2545322#.XEW5sC0o8uU (REDc.rar -> CCD_plugins -> REDCCDPlugin.dll). It should go in the DM plugins directory (C:\ProgramData\Gatan\Plugins). Hope that works!

thomasaarholt commented 4 years ago

Yep, that did the trick. I created a dummy getCurrentDensity method for the fei_microscope, and now the instamatic GUI opens.

I just tried doing a cRED acquisition, but I do get an error here as well once it attempts to read from the gatan camera. I tried with and without live view on in GMS, with both our cameras (This raises the question: How does instamatic know which camera to acquire from?)

thomasaarholt commented 4 years ago

Btw, I've got full control of the beam aspects. Really enjoying making the beam do my bidding by spinning in spirals :)

stefsmeets commented 4 years ago

That's one part done! The camera is quite tricky, I have not extensively used a gatan camera in the recent years.

I just tried doing a cRED acquisition, but I do get an error here as well once it attempts to read from the gatan camera. I tried with and without live view on in GMS, with both our cameras (This raises > the question: How does instamatic know which camera to acquire from?)

I think it just takes the active one. Not sure the cRED acquisition can work as it is. Can you try on the command line: instamatic.controller.exe and then :ctrl.getRawImage()? It should output a numpy array.

I found that CRED acquisition is very dependent on the camera, and I have not been able to find a consistent routine that works with every camera. For DM, we developed a script last year: https://github.com/stefsmeets/insteadmatic which actually does the job quite well.

At the moment, it's not possible to do CRED in DM with instamatic. I have some code that can run custom DM scripts from Python. I think it should be easy to write some code that just sends a command to capture the live view from instamatic write the data to a tiff file. Then the entire acquisition can be controlled and automated through Python.

thomasaarholt commented 4 years ago

I got super quick help from the SerialEM community, and installed it this afternoon. I was shortly able to both successfully run the gatansocket3.py "hello world" printing in GMS3, as well as acquire images from the ctrl.getRawImage() function! I'm not sure if getRawImage depends on SerialEM? In any case, this is very exciting, and I'm looking forward to seeing what I can get out of this, particularly with respect to EELS!

stefsmeets commented 4 years ago

I got super quick help from the SerialEM community, and installed it this afternoon. I was shortly able to both successfully run the gatansocket3.py "hello world" printing in GMS3, as well as acquire images from the ctrl.getRawImage() function! I'm not sure if getRawImage depends on SerialEM? In any case, this is very exciting, and I'm looking forward to seeing what I can get out of this, particularly with respect to EELS!

That's nice to hear! The getRawImage uses the RED plugin for DM I linked before. It was developed in Stockholm and therefore easy to get started with.

The gatansocket3.py uses the SerialEM plugin for DM and is much more flexible and better maintained. I came across it a while ago and I was curious whether it could be used to do continuous acquisition through Python in DM. I find it particularly exciting that you can send execute DM scripts, something I wish I had a couple of years ago. I intend to make getRawImage/getImage depend on that, as well as continuous acquisition, but I have not gotten to it yet.