Skip to content
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

Photon counting #25

Open
wants to merge 16 commits into
base: develop
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 12 additions & 4 deletions acq4/devices/DAQGeneric/DAQGeneric.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,13 @@ def getChanOffset(self, chan):
## Offset defaults to 0.0
## - can be overridden in configuration
return self._DGConfig[chan].get('offset', 0.0)


def getChanType(self, chan):
with self._DGLock:
## Offset defaults to 0.0
## - can be overridden in configuration
return self._DGConfig[chan]['type']

def getChanUnits(self, ch):
with self._DGLock:
if 'units' in self._DGConfig[ch]:
Expand Down Expand Up @@ -335,7 +341,7 @@ def createChannels(self, daqTask):
continue

## Input channels are only used if the command has record: True
if chConf['type'] in ['ai', 'di']:
if chConf['type'] in ['ai', 'di', 'ci']:
#if ('record' not in self._DAQCmd[ch]) or (not self._DAQCmd[ch]['record']):
if not self._DAQCmd[ch].get('record', False):
#print " ignoring channel", ch, "recording disabled"
Expand Down Expand Up @@ -382,7 +388,9 @@ def createChannels(self, daqTask):
elif chConf['type'] == 'di':
daqTask.addChannel(chConf['channel'], chConf['type'], **self._DAQCmd[ch].get('lowLevelConf', {}))
self.daqTasks[ch] = daqTask ## remember task so we can stop it later on

elif chConf['type'] == 'ci':
daqTask.addChannel(chConf['channel'], chConf['type'], **self._DAQCmd[ch].get('lowLevelConf', {}))
self.daqTasks[ch] = daqTask ## remember task so we can stop it later on


def getChanUnits(self, chan):
Expand Down Expand Up @@ -427,7 +435,7 @@ def getResult(self):
result = {}
for ch in self.bufferedChannels:
result[ch] = self.daqTasks[ch].getData(self.dev._DGConfig[ch]['channel'])
result[ch]['data'] = self.mapping.mapFromDaq(ch, result[ch]['data']) ## scale/offset/invert
result[ch]['data'] = self.mapping.mapFromDaq(ch, result[ch]['data']) ## scale/offset/invert/differentiate
result[ch]['units'] = self.getChanUnits(ch)

if len(result) > 0:
Expand Down
2 changes: 1 addition & 1 deletion acq4/devices/DAQGeneric/taskGUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def createChannelWidget(self, ch, daqName=None):
if conf['type'] in ['ao', 'do']:
w = OutputChannelGui(self, ch, conf, p, self.dev, self.taskRunner, daqName)
w.sigSequenceChanged.connect(self.sequenceChanged)
elif conf['type'] in ['ai', 'di']:
elif conf['type'] in ['ai', 'di','ci']:
w = InputChannelGui(self, ch, conf, p, self.dev, self.taskRunner, daqName)
else:
raise Exception("Unrecognized device type '%s'" % conf['type'])
Expand Down
4 changes: 3 additions & 1 deletion acq4/devices/NiDAQ/nidaq.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,9 @@ def getData(self, channel):
else:
printExc("Unknown denoise method '%s'" % str(method))


if res['info']['type'] in ['ci']:
data = numpy.diff(numpy.hstack((0,data)))

res['data'] = data
res['info']['numPts'] = data.shape[0]

Expand Down
4,220 changes: 3,721 additions & 499 deletions acq4/drivers/nidaq/NIDAQmx.h

Large diffs are not rendered by default.