Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
gduscher committed Jan 27, 2024
1 parent cb5dca5 commit f53713f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 47 deletions.
Binary file modified logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 0 additions & 47 deletions tests/test_eels_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,50 +171,3 @@ def test_effective_collection_angle(self):
def test_get_db_spectra(self):
spec_db = eels.get_spectrum_eels_db(formula='MgO', edge='K', title=None, element='O')
self.assertIsInstance(spec_db, dict)



import Pyro5.api
import DigitalMicrograph as DM
import numpy as np

@Pyro5.api.expose
class CameraServer:
def __init__(self):
self.cam = None
self.preImg = None
self.kproc = None

def activate_camera(self, height=200):
self.cam = DM.GetActiveCamera()
self.cam.PrepareForAcquire()
height = int(height/2)
bin = 1
self.kproc = DM.GetCameraUnprocessedEnum() # or DM.GetCameraGainNormalizedEnum()

self.preImg = self.cam.CreateImageForAcquire(bin, bin, self.kproc, 1024-height, 0, 1024+height, 2048)
return "Camera activated"

def acquire_camera(self, exposure=0.1, height=200):
if self.cam is None or self.preImg is one:
return "Camera not activated"
self.preImg.SetName("Pre-created image container")
self.preImg.ShowImage()
height = int(height/2)
self.cam.AcquireInPlace(self.preImg, exposure, 1, 1, self.kproc, 1024-height, 0, 1024+height, 2048)
dmImgData = self.preImg.GetNumArray()
return dmImgData.tolist() # Convert numpy array to list for serialization

def close_camera(self):
if self.preImg is not None:
del self.preImg
return "Camera closed"

def main():
daemon = Pyro5.api.Daemon(host="10.46.218.0", port=65433) # Choose an appropriate port
uri = daemon.register(CameraServer, "camera.server")
print("Camera Server is waiting for connections... Object uri =", uri)
daemon.requestLoop()

if __name__ == "__main__":
main()

0 comments on commit f53713f

Please sign in to comment.