/dev/enabled (if that file
- exists)."""
- if LABSCRIPT_SUITE_PROFILE is None:
- return
- dev_dir = LABSCRIPT_SUITE_PROFILE / 'dev'
- enabled_file = dev_dir / 'enabled'
- if not os.path.exists(enabled_file):
- return
- with open(enabled_file) as f:
- for line in f:
- repository = dev_dir / line.strip()
- if os.path.isdir(repository):
- sys.path.insert(0, repository)
+ site.addsitedir(path)
diff --git a/labscript_profile/default_profile/labconfig/example.ini b/labscript_profile/default_profile/labconfig/example.ini
index f72dca5..63851aa 100644
--- a/labscript_profile/default_profile/labconfig/example.ini
+++ b/labscript_profile/default_profile/labconfig/example.ini
@@ -10,8 +10,8 @@ app_saved_configs = %(labscript_suite)s\app_saved_configs\%(apparatus_name)s
user_devices = user_devices
[paths]
-connection_table_h5 = %(experiment_shot_storage)s\connectiontable.h5
-connection_table_py = %(labscriptlib)s\connectiontable.py
+connection_table_h5 = %(experiment_shot_storage)s\connection_table.h5
+connection_table_py = %(labscriptlib)s\connection_table.py
[servers]
zlock = localhost
diff --git a/labscript_profile/default_profile/userlib/analysislib/example_apparatus/example_IMAQdx_remote.py b/labscript_profile/default_profile/userlib/analysislib/example_apparatus/example_IMAQdx_remote.py
new file mode 100644
index 0000000..e4c30b7
--- /dev/null
+++ b/labscript_profile/default_profile/userlib/analysislib/example_apparatus/example_IMAQdx_remote.py
@@ -0,0 +1,46 @@
+import lyse
+from pathlib import Path
+import matplotlib.pyplot as plt
+
+# Is this script being run from within an interactive lyse session?
+if lyse.spinning_top:
+ # If so, use the filepath of the current shot
+ h5_path = lyse.path
+else:
+ # If not, get the filepath of the last shot of the lyse DataFrame
+ df = lyse.data()
+ h5_path = df.filepath.iloc[-1]
+
+# Instantiate a lyse.Run object for this shot
+run = lyse.Run(h5_path)
+
+# Get a dictionary of the global variables used in this shot
+run_globals = run.get_globals()
+
+# Extract the images 'before' and 'after' generated from camera.expose
+before, after = run.get_images('camera', 'comparison', 'before', 'after')
+
+# Compute the difference of the two images, after casting them to signed integers
+# (otherwise negative differences wrap to 2**16 - 1 - diff)
+diff = after.astype('int16') - before.astype('int16')
+
+# Plot the row-wise mean of each image
+plt.plot(before.mean(axis=0), label='before')
+plt.plot(after.mean(axis=0), label='after')
+plt.xlabel('pixel coordinate (column)')
+plt.ylabel('counts')
+
+# Label the plot with a unique string representing the shot
+plt.title(Path(run.h5_path).name)
+
+# Plot adornments
+plt.legend(loc='lower left')
+plt.grid()
+
+# Show the plot
+plt.show()
+
+# Compute a result based on the image processing and save it to the 'results' group of
+# the shot file
+result = diff.std()
+run.save_result('foobar', result)
diff --git a/labscript_profile/default_profile/userlib/labscriptlib/example_apparatus/connection_table.py b/labscript_profile/default_profile/userlib/labscriptlib/example_apparatus/connection_table.py
new file mode 100644
index 0000000..9a5f5e6
--- /dev/null
+++ b/labscript_profile/default_profile/userlib/labscriptlib/example_apparatus/connection_table.py
@@ -0,0 +1,27 @@
+from labscript import start, stop, add_time_marker, AnalogOut, DigitalOut
+from labscript_devices.DummyPseudoclock.labscript_devices import DummyPseudoclock
+from labscript_devices.DummyIntermediateDevice import DummyIntermediateDevice
+
+# Use a virtual, or 'dummy', device for the psuedoclock
+DummyPseudoclock(name='pseudoclock')
+
+# An output of this DummyPseudoclock is its 'clockline' attribute, which we use
+# to trigger children devices
+DummyIntermediateDevice(name='intermediate_device', parent_device=pseudoclock.clockline)
+
+# Create an AnalogOut child of the DummyIntermediateDevice
+AnalogOut(name='analog_out', parent_device=intermediate_device, connection='ao0')
+
+# Create a DigitalOut child of the DummyIntermediateDevice
+DigitalOut(
+ name='digital_out', parent_device=intermediate_device, connection='port0/line0'
+)
+
+
+if __name__ == '__main__':
+ # Begin issuing labscript primitives
+ # start() elicits the commencement of the shot
+ start()
+
+ # Stop the experiment shot with stop()
+ stop(1.0)
diff --git a/labscript_profile/default_profile/userlib/labscriptlib/example_apparatus/connection_table_IMAQdx_remote.py b/labscript_profile/default_profile/userlib/labscriptlib/example_apparatus/connection_table_IMAQdx_remote.py
new file mode 100644
index 0000000..5bc412f
--- /dev/null
+++ b/labscript_profile/default_profile/userlib/labscriptlib/example_apparatus/connection_table_IMAQdx_remote.py
@@ -0,0 +1,40 @@
+from labscript import start, stop, add_time_marker, Trigger, RemoteBLACS
+from labscript_devices.DummyPseudoclock.labscript_devices import DummyPseudoclock
+from labscript_devices.DummyIntermediateDevice import DummyIntermediateDevice
+from labscript_devices.IMAQdxCamera.labscript_devices import IMAQdxCamera
+
+# Use a virtual ('dummy') device for the psuedoclock
+DummyPseudoclock(name='pseudoclock')
+
+# An output of this DummyPseudoclock is its 'clockline' attribute, which we use
+# to trigger children devices
+DummyIntermediateDevice(name='intermediate_device', parent_device=pseudoclock.clockline)
+
+# Instantiate a labscript.Trigger instance used to trigger the camera exposure
+# This will be specified as the camera's parent device later
+Trigger(
+ name='camera_trigger', parent_device=intermediate_device, connection='port0/line0'
+)
+
+# On the host specified below, start the RemoteBLACS server by running the following:
+# $ python - m labscript_utils.remote
+RemoteBLACS(name='test_remote', host='localhost')
+
+# We then initiate an IMAQdxCamera using this RemoteBLACS instance
+# using mock=True to bypass any attempts to commmunicate with an
+# actual camera, and generate fake data at the end of the shot
+IMAQdxCamera(
+ name='camera',
+ parent_device=camera_trigger,
+ connection='trigger',
+ serial_number=0xDEADBEEF,
+ worker=test_remote,
+ mock=True,
+)
+
+# Begin issuing labscript primitives
+# start() elicits the commencement of the shot
+start()
+
+# Stop the experiment shot with stop()
+stop(1.0)
diff --git a/labscript_profile/default_profile/userlib/labscriptlib/example_apparatus/example_IMAQdx_remote.py b/labscript_profile/default_profile/userlib/labscriptlib/example_apparatus/example_IMAQdx_remote.py
new file mode 100644
index 0000000..d0a3a61
--- /dev/null
+++ b/labscript_profile/default_profile/userlib/labscriptlib/example_apparatus/example_IMAQdx_remote.py
@@ -0,0 +1,51 @@
+from labscript import start, stop, add_time_marker, Trigger, RemoteBLACS
+from labscript_devices.DummyPseudoclock.labscript_devices import DummyPseudoclock
+from labscript_devices.DummyIntermediateDevice import DummyIntermediateDevice
+from labscript_devices.IMAQdxCamera.labscript_devices import IMAQdxCamera
+
+# Use a virtual ('dummy') device for the psuedoclock
+DummyPseudoclock(name='pseudoclock')
+
+# An output of this DummyPseudoclock is its 'clockline' attribute, which we use
+# to trigger children devices
+DummyIntermediateDevice(name='intermediate_device', parent_device=pseudoclock.clockline)
+
+# Instantiate a labscript.Trigger instance used to trigger the camera exposure
+# This will be specified as the camera's parent device later
+Trigger(
+ name='camera_trigger', parent_device=intermediate_device, connection='port0/line0'
+)
+
+# On the host specified below, start the RemoteBLACS server by running the following:
+# $ python - m labscript_utils.remote
+RemoteBLACS(name='test_remote', host='localhost')
+
+# We then initiate an IMAQdxCamera using this RemoteBLACS instance
+# using mock=True to bypass any attempts to commmunicate with an
+# actual camera, and generate fake data at the end of the shot
+IMAQdxCamera(
+ name='camera',
+ parent_device=camera_trigger,
+ connection='trigger',
+ serial_number=0xDEADBEEF,
+ worker=test_remote,
+ mock=True,
+)
+
+# Begin issuing labscript primitives
+# A timing variable t is used for convenience
+# start() elicits the commencement of the shot
+t = 0
+add_time_marker(t, "Start", verbose=True)
+start()
+
+t += 1
+add_time_marker(t, "Exposure: 'before' image", verbose=True)
+camera.expose(t, name='comparison', frametype='before', trigger_duration=0.2)
+
+t += 0.5
+add_time_marker(t, "Exposure: 'after' image", verbose=True)
+camera.expose(t, name='comparison', frametype='after', trigger_duration=0.2)
+
+t += 0.5
+stop(t)
diff --git a/labscript_profile/default_profile/userlib/labscriptlib/example_apparatus/example_experiment.py b/labscript_profile/default_profile/userlib/labscriptlib/example_apparatus/example_experiment.py
new file mode 100644
index 0000000..1f3c33e
--- /dev/null
+++ b/labscript_profile/default_profile/userlib/labscriptlib/example_apparatus/example_experiment.py
@@ -0,0 +1,48 @@
+from labscript import start, stop, add_time_marker, AnalogOut, DigitalOut
+from labscript_devices.DummyPseudoclock.labscript_devices import DummyPseudoclock
+from labscript_devices.DummyIntermediateDevice import DummyIntermediateDevice
+
+# Use a virtual, or 'dummy', device for the psuedoclock
+DummyPseudoclock(name='pseudoclock')
+
+# An output of this DummyPseudoclock is its 'clockline' attribute, which we use
+# to trigger children devices
+DummyIntermediateDevice(name='intermediate_device', parent_device=pseudoclock.clockline)
+
+# Create an AnalogOut child of the DummyIntermediateDevice
+AnalogOut(name='analog_out', parent_device=intermediate_device, connection='ao0')
+
+# Create a DigitalOut child of the DummyIntermediateDevice
+DigitalOut(
+ name='digital_out', parent_device=intermediate_device, connection='port0/line0'
+)
+
+# Begin issuing labscript primitives
+# A timing variable t is used for convenience
+# start() elicits the commencement of the shot
+t = 0
+add_time_marker(t, "Start", verbose=True)
+start()
+
+# Wait for 1 second with all devices in their default state
+t += 1
+
+# Change the state of digital_out, and denote this using a time marker
+add_time_marker(t, "Toggle digital_out (high)", verbose=True)
+digital_out.go_high(t)
+
+# Wait for 0.5 seconds
+t += 0.5
+
+# Ramp analog_out from 0.0 V to 1.0 V over 0.25 s with a 1 kS/s sample rate
+t += analog_out.ramp(t=t, initial=0.0, final=1.0, duration=0.25, samplerate=1e3)
+
+# Change the state of digital_out, and denote this using a time marker
+add_time_marker(t, "Toggle digital_out (low)", verbose=True)
+digital_out.go_low(t)
+
+# Wait for 0.5 seconds
+t += 0.5
+
+# Stop the experiment shot with stop()
+stop(t)
diff --git a/labscript_utils/camera_server.py b/labscript_utils/camera_server.py
index 3389e66..cf576b5 100644
--- a/labscript_utils/camera_server.py
+++ b/labscript_utils/camera_server.py
@@ -158,7 +158,7 @@ def transition_to_static(self, h5_filepath):
them to the h5 file"""
import pyfits
start_time = time.time()
- with h5py.File(h5_filepath) as f:
+ with h5py.File(h5_filepath, 'r+') as f:
group = f['devices']['camera']
if not 'EXPOSURES' in group:
print('no images taken this shot')
diff --git a/setup.py b/setup.py
index 12b22ca..66a147b 100644
--- a/setup.py
+++ b/setup.py
@@ -1,9 +1,24 @@
import os
from setuptools import setup
+from setuptools.command.develop import develop
+from distutils import log
+
+
+class develop_command(develop):
+ """Custom develop command which installs the .pth file to site-packages for editable
+ installs."""
+ def run(self):
+ path = os.path.join(self.install_dir, 'labscript-suite.pth')
+ super().run()
+ if not self.uninstall:
+ log.info(f'Copying labscript-suite.pth to {path}')
+ if not self.dry_run:
+ self.copy_file('labscript-suite.pth', path)
+
VERSION_SCHEME = {
"version_scheme": os.getenv("SCM_VERSION_SCHEME", "guess-next-dev"),
"local_scheme": os.getenv("SCM_LOCAL_SCHEME", "node-and-date"),
}
-setup(use_scm_version=VERSION_SCHEME)
+setup(use_scm_version=VERSION_SCHEME, cmdclass={'develop': develop_command})
pFad - Phonifier reborn
Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy