Skip to content

Implement a class version of EvoraServer and add argument parsing #41

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,7 @@ dmypy.json
node_modules

# Ignore data folder if debugging
data/
data/

# Ignore debug.py for now
debug.py
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pip install -e .

### Debug mode

To run the server in debug mode, with the dummy module mocking the camera, edit `evora/debug.py` and set `DEBUGGING = True`. This will create a folder in the `evora-server` root that acts as the `/data` folder.
To run the server in debug mode, with the dummy module mocking the camera, run the server with the `--debug` flag, like `python app.py --debug`. At first run this will create a folder in the `evora-server` root that acts as the `/data` folder.

## Running the server

Expand Down
24 changes: 13 additions & 11 deletions andor_routines.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
from evora.debug import DEBUGGING

if DEBUGGING:
from evora.dummy import Dummy as andor
else:
import evora.andor as andor
import time

# biases: Readout noise from camera (effectively 0 s exposure)
# flats: take an image with even lighting (i.e. the white paint of the dome)
# darks: image while shutter closed


def startup():
def startup(andor):
'''
Initializes the camera and sets the acquisition mode to single scan.

Parameters:
- andor: andor camera instance

Returns:
- dimensions: tuple of the image dimensions
'''
Expand All @@ -31,11 +28,12 @@ def startup():
return {"dimensions": image_dimensions, "status": 20002}


def activateCooling(target_temperature=-10):
def activateCooling(andor, target_temperature=-10):
'''
Activates the camera cooling system and sets the target temperature.

Parameters:
- andor: andor camera instance
- target_temperature: the desired temperature of the camera sensor

Returns:
Expand All @@ -47,11 +45,12 @@ def activateCooling(target_temperature=-10):

return 20002

def deactivateCooling(fan_mode_high=False):
def deactivateCooling(andor, fan_mode_high=False):
'''
Deactivates the camera cooling system.

Parameters:
- andor: andor camera instance
- fan_mode_high: whether the fan mode should be set to high

Returns:
Expand All @@ -63,12 +62,14 @@ def deactivateCooling(fan_mode_high=False):
return 20002


def acquisition(dim, exposure_time=0.1):
def acquisition(andor, dim, exposure_time=0.1):
'''
Acquires an image with the given dimensions and exposure time.

Parameters:
- andor: andor camera instance
- dim: tuple of the image dimensions
- exposure_time: how long to expose for (sec)

Returns:
- data: the acquired image data
Expand All @@ -83,11 +84,12 @@ def acquisition(dim, exposure_time=0.1):
return {"data": andor.getAcquiredData(dim)["data"], "status": 20002}


def acquireBias(dim):
def acquireBias(andor, dim):
'''
Acquires a bias image.

Parameters:
- andor: andor camera instance
- dim: tuple of the image dimensions

Returns:
Expand Down
Loading