Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
1bc26cf
Created driver for NewPort powermeter 1830c.
Aug 5, 2014
ce29ba3
Fixed docstring header
hgrecco Aug 5, 2014
f221f2b
Migrated drivers to messagebased
hgrecco Dec 31, 2014
809591d
Mock modules to allow Docs to be rendered online
hgrecco Dec 31, 2014
2dae115
Documentation fixes
hgrecco Dec 31, 2014
1aae25b
Adjusted instruments to changes in MessageBasedDriver
hgrecco Jan 6, 2015
3f2d531
Bumped copyright year to 2015
hgrecco Jan 10, 2015
0ae135a
Rudimentary driver for Newport ESP301 motion controllers
vascotenner Jan 26, 2015
f84311e
Merge branch 'xenics'
vascotenner Sep 7, 2015
6ac136c
Newport ESP301 driver now works with new-style lantz driver
vascotenner Sep 9, 2015
2832967
More improvements on newport motion controller
vascotenner Sep 21, 2015
e8189f8
Initial commit
vascotenner Sep 21, 2015
8f6c3e5
Merge branch 'newport' of ../lantz
vascotenner Sep 21, 2015
647e412
Added AUTHORS and removed powermeter from the stage repository
vascotenner Sep 21, 2015
077cf1e
Also removed powermeter from __init__
vascotenner Sep 21, 2015
b189a12
Problems with backlash and units. Reduced some caching
vascotenner Nov 13, 2015
6f6b779
Axes detection more robust and backlash working
vascotenner Dec 3, 2015
f801793
The implementation of backlash and wait until done is problematic. Now
vascotenner Apr 8, 2016
2b34d12
Moved more into detect_axis function
Apr 25, 2016
49d3203
Added ESP300 to docstring
vascotenner Feb 23, 2017
adb1be7
Check position of stage after movement
vascotenner Feb 23, 2017
d744cb7
Added vim backup and swap files to gitignore
vascotenner Feb 27, 2017
2a42718
Fixed errounous test and changed depricated warn
vascotenner Jan 2, 2018
46ed66b
First version of driver for PI piezo driver
vascotenner Jan 12, 2018
b4a0c9a
Added support for PI E-709 piezo driver
vascotenner Jan 17, 2018
ffda646
Added my to authors
vascotenner Jan 17, 2018
4be7216
Action: log of data is optional
vascotenner Jan 29, 2018
7c85676
Support for Basler imaging cameras via PyPylon
vascotenner Jan 29, 2018
5f36d8d
Added module newport_esp motion controllers
vascotenner Jan 29, 2018
a009542
Moved newton esp to newton_motion
vascotenner Feb 28, 2018
8a3e480
Seperated most generic newport motion controller in own class. Added …
vascotenner Feb 28, 2018
4985444
Fixed units for exposuretime
vascotenner Feb 28, 2018
e074024
Dynamically load feats to driver
vascotenner Feb 28, 2018
e282510
Submodule for newport motion and support for smc100 motion stage
vascotenner Mar 5, 2018
73f4d6f
Added reference list of possible properties
vascotenner Mar 5, 2018
0937df3
Basler camera: roi selection
vascotenner Mar 26, 2018
1ed78e0
Moved motion drivers of newport to submodule
vascotenner Mar 26, 2018
9135b50
Fixed ROI selection in basler pylon camera driver
vascotenner Apr 4, 2018
4f17d96
Added Sacher Drivers
AlexLCrook Jun 27, 2018
82b1438
latest lantz server
kcmiao Aug 31, 2018
ef4fa08
Added safe fail back on import for lightfield drivers (for remote users)
kcmiao Aug 31, 2018
2641410
Merge branch 'drivers_develop' of https://github.com/awsch/lantz into…
kcmiao Aug 31, 2018
d49ee68
Made Device_Client dynamically created classes subclasses of the devi…
AlexBourassa Oct 12, 2018
e466886
lantz-monitor: ignore mallformed messaged
vascotenner Oct 16, 2018
50bd138
Extended support for SMC100 controllor
vascotenner Oct 16, 2018
d246108
Extended piezo support
vascotenner Dec 3, 2018
703905a
copied newport_motion code to this repository
vascotenner Dec 3, 2018
ccdf99d
second part of copy
vascotenner Dec 3, 2018
6f4c068
Extended requirements. Updated docstring of Feat
vascotenner Dec 4, 2018
505ce19
Extended driver for allied vision cameras.
vascotenner Dec 4, 2018
aa3058a
Merge branch 'awsch/drivers_develop' into drivers_developv. Changes in
vascotenner Dec 4, 2018
06d3670
Add option to change unit of feats and actions easily
vascotenner Dec 11, 2018
1c89a63
Merge branch 'drivers_developv' of github.com:vascotenner/lantz into …
vascotenner Dec 11, 2018
4f7fabe
Added seperate driver for translation and rotation stages
vascotenner Dec 11, 2018
a3b515d
Fixed classes newport motion
vascotenner Dec 11, 2018
6218d11
Fixed classes newport motion
vascotenner Dec 11, 2018
0a23e88
First version of driver for Smaract piezo stages
vascotenner Dec 12, 2018
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
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ Martin Masip <martinmasip@gmail.com>
Pablo Jais <jaisp@df.uba.ar>
Martin Caldarola <caldarolamartin@gmail.com>
Federico Barabas <fede.barabas@gmail.com>
Vasco Tenner <v.t.tenner@vu.nl>
17 changes: 13 additions & 4 deletions lantz/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from .processors import (Processor, FromQuantityProcessor,
MapProcessor, RangeProcessor)

from .feat import MISSING
from .feat import MISSING, FeatActionUpdateModifiersMixing


def _dget(adict, instance=MISSING):
Expand All @@ -46,7 +46,7 @@ def _dset(adict, value, instance=MISSING):
adict[instance] = value


class Action(object):
class ActionBase(object):
"""Wraps a Driver method with Lantz. Can be used as a decorator.

Processors can registered for each arguments to modify their values before
Expand All @@ -63,10 +63,11 @@ class Action(object):
changed but only tested to belong to the container.
:param units: `Quantity` or string that can be interpreted as units.
:param procs: Other callables to be applied to input arguments.
:param log_output: Store the functions output in log

"""

def __init__(self, func=None, *, values=None, units=None, limits=None, procs=None):
def __init__(self, func=None, *, values=None, units=None, limits=None, procs=None, log_output=True):

#: instance: key: value
self.modifiers = WeakKeyDictionary()
Expand All @@ -76,6 +77,7 @@ def __init__(self, func=None, *, values=None, units=None, limits=None, procs=Non
'units': units,
'limits': limits,
'processors': procs}
self.log_output = log_output
self.func = func
self.args = ()

Expand Down Expand Up @@ -126,7 +128,10 @@ def call(self, instance, *args, **kwargs):
tic = time.time()
out = self.func(instance, *t_values)
instance.timing.add(name, time.time() - tic)
instance.log_info('{} returned {}', name, out)
if self.log_output:
instance.log_info('{} returned {}', name, out)
else:
instance.log_info('{} returned a value of type {}', name, type(out))

return out
except Exception as e:
Expand Down Expand Up @@ -196,6 +201,10 @@ def rebuild(self, instance=MISSING, build_doc=False, modifiers=None, store=False
return procs


class Action(ActionBase, FeatActionUpdateModifiersMixing):
pass


class ActionProxy(object):
"""Proxy object for Actions that allows to
store instance specific modifiers.
Expand Down
32 changes: 32 additions & 0 deletions lantz/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
from functools import wraps
from concurrent import futures
from collections import defaultdict
import itertools

from .utils.qt import MetaQObject, SuperQObject, QtCore
from .feat import Feat, DictFeat, MISSING, FeatProxy
from .action import Action, ActionProxy
from .stats import RunningStats
from .log import get_logger
from . import Q_

logger = get_logger('lantz.driver', False)

Expand All @@ -42,6 +44,17 @@ def _merge_dicts(*args):

return out

def unit_to_string(units):
return str(Q_(units).units)

def unit_replace(unit, old, new):
unit = unit.split(' ')
for i, part in enumerate(unit):
if part == old:
unit[i] = new

return ' '.join(unit)


class MetaSelf(type):
"""Metaclass for Self object
Expand Down Expand Up @@ -466,6 +479,25 @@ def feats(self):
def actions(self):
return Proxy(self, self._lantz_actions, ActionProxy)

def update_units(self, old_units, units):
"""Updates the units of all feats and actions and actions from self.units to units.

E.g. mm/s -> radian.s

:param old_units: string or units
:param units: string or units
:return:
"""

old_units_str = unit_to_string(old_units)
units_str = unit_to_string(units)

for featname, feat in itertools.chain(self.feats.items(), self.actions.items()):
old_feat_units_str = unit_to_string(feat.feat.modifiers[MISSING][MISSING]['units'])
new_feat_units = unit_replace(old_feat_units_str, old_units_str, units_str)
self.log_debug("Updating units of feat {} from {} to {}", featname, old_feat_units_str, new_feat_units)
feat.feat.change_units(units=new_feat_units)


def _solve_dependencies(dependencies, all_members=None):
"""Solve a dependency graph.
Expand Down
4 changes: 2 additions & 2 deletions lantz/drivers/alliedvision/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .vimba import VimbaCam
from .vimba2 import VimbaCam, list_cameras

__all__ = ['VimbaCam']
__all__ = ['VimbaCam', 'list_cameras']
4 changes: 4 additions & 0 deletions lantz/drivers/alliedvision/tests/vimbatest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from lantz.drivers.alliedvision import list_cameras

if __name__ == '__main__':
print(list_cameras())
Loading