Skip to content

Commit

Permalink
add a flag to decide to get the normalized/absolute number of counts …
Browse files Browse the repository at this point in the history
…in time trace

enable herald manipulator on measurement mode T3 in histogram measurement class with dTimes set default binWidth in histogram measurement
Fix binning in T3
don't measure on invalid devices
PTU:
- fix fast load tags
- fix binning value
  • Loading branch information
tpoint75 committed Jun 29, 2023
1 parent bebc6d8 commit 2b2d1ac
Show file tree
Hide file tree
Showing 32 changed files with 55 additions and 7 deletions.
Binary file removed dist/snAPI-0.2.3-cp311-cp311-win_amd64.whl
Binary file not shown.
Binary file removed dist/snAPI-0.2.3.tar.gz
Binary file not shown.
Binary file added dist/snAPI-0.2.4-cp311-cp311-win_amd64.whl
Binary file not shown.
Binary file added dist/snAPI-0.2.4.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/searchindex.js

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions docs/snAPI.Main.html
Original file line number Diff line number Diff line change
Expand Up @@ -2025,6 +2025,12 @@ <h2>Info<a class="headerlink" href="#info" title="Permalink to this heading">#</
until the measurement is completed. If you wish to avoid blocking you can pass waitFinished False
and proceed with other code. In order to check later if the measurement is completed you can use
the <a class="reference internal" href="#snAPI_Main_Raw_isFinished" title="snAPI.Main.Raw.isFinished"><code class="xref py py-meth docutils literal notranslate"><span class="pre">isFinished()</span></code></a> function. The data can be accessed with <a class="reference internal" href="#snAPI_Main_Raw_getData" title="snAPI.Main.Raw.getData"><code class="xref py py-meth docutils literal notranslate"><span class="pre">getData()</span></code></a>.</p>
<div class="admonition caution">
<p class="admonition-title">Caution</p>
<p>The <cite>Raw Buffer overrun - clearing!</cite> warning or <cite>Raw Buffer full - waiting!</cite> info means, that data cant be stored
in the allocated memory <cite>size</cite>. Increase the memory <cite>size</cite>, use the non blocking measure or the <a class="reference internal" href="#snAPI_Main_Raw_startBlock" title="snAPI.Main.Raw.startBlock"><code class="xref py py-meth docutils literal notranslate"><span class="pre">startBlock()</span></code></a>
and <code class="xref py py-meth docutils literal notranslate"><span class="pre">readBlock()</span></code>!</p>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>If you want to write the data to disc only, set the size to zero.</p>
Expand Down Expand Up @@ -2483,6 +2489,12 @@ <h2>Info<a class="headerlink" href="#info" title="Permalink to this heading">#</
If you wish to avoid blocking you can pass waitFinished False and proceed with other code. In order
to check later if the measurement is completed you can use the <a class="reference internal" href="#snAPI_Main_Unfold_isFinished" title="snAPI.Main.Unfold.isFinished"><code class="xref py py-meth docutils literal notranslate"><span class="pre">isFinished()</span></code></a> function.
The data can be accessed with <a class="reference internal" href="#snAPI_Main_Unfold_getData" title="snAPI.Main.Unfold.getData"><code class="xref py py-meth docutils literal notranslate"><span class="pre">getData()</span></code></a>.</p>
<div class="admonition caution">
<p class="admonition-title">Caution</p>
<p>The <cite>Unfold buffer overrun - clearing!</cite> warning or <cite>Unfold Buffer full - waiting!</cite> info means, that data cant be stored
in the allocated memory <cite>size</cite>. Increase the memory <cite>size</cite>, use the non blocking measure or the <a class="reference internal" href="#snAPI_Main_Unfold_startBlock" title="snAPI.Main.Unfold.startBlock"><code class="xref py py-meth docutils literal notranslate"><span class="pre">startBlock()</span></code></a>
and <code class="xref py py-meth docutils literal notranslate"><span class="pre">readBlock()</span></code>!</p>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
Expand Down
48 changes: 42 additions & 6 deletions snAPI/Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1907,6 +1907,12 @@ def measure(self, acqTime: typing.Optional[int] = 1000, size: typing.Optional[in
and proceed with other code. In order to check later if the measurement is completed you can use
the :meth:`isFinished` function. The data can be accessed with :meth:`getData`.
Caution
-------
The `Raw Buffer overrun - clearing!` warning or `Raw Buffer full - waiting!` info means, that data cant be stored
in the allocated memory `size`. Increase the memory `size`, use the non blocking measure or the :meth:`startBlock`
and :meth:`readBlock`!
Note
----
If you want to write the data to disc only, set the size to zero.
Expand Down Expand Up @@ -1953,6 +1959,9 @@ def measure(self, acqTime: typing.Optional[int] = 1000, size: typing.Optional[in
"""
self.data = ct.ARRAY(ct.c_uint32, size)()
if(self.parent.deviceConfig["MeasMode"] == MeasMode.Histogram.value):
self.parent.logPrint( "measurement is not supported for Raw class in MeasMode:", MeasMode(self.parent.deviceConfig["MeasMode"]).name)
return False
return self.parent.dll.rawMeasure(acqTime, waitFinished, savePTU, ct.byref(self.data), self.idx, ct.c_uint64(size), self.finished)


Expand Down Expand Up @@ -2001,6 +2010,9 @@ def startBlock(self, acqTime: typing.Optional[int] = 1000, size: typing.Optional
"""
self.storeData = ct.ARRAY(ct.c_uint32, size)()
self.data = ct.ARRAY(ct.c_uint32, size)()
if(self.parent.deviceConfig["MeasMode"] == MeasMode.Histogram.value):
self.parent.logPrint( "startBlock is not supported for Raw class in MeasMode:", MeasMode(self.parent.deviceConfig["MeasMode"]).name)
return False
return self.parent.dll.rawStartBlock(acqTime, savePTU, ct.byref(self.storeData), ct.c_uint64(size), self.finished)


Expand Down Expand Up @@ -2034,8 +2046,12 @@ def getBlock(self):
"""
size = ct.pointer(ct.c_uint64(0))
self.parent.dll.rawGetBlock(ct.byref(self.data), size)
self.idx.contents.value = size.contents.value
if(self.parent.deviceConfig["MeasMode"] == MeasMode.Histogram.value):
self.parent.logPrint( "startBlock is not supported for Raw class in MeasMode:", MeasMode(self.parent.deviceConfig["MeasMode"]).name)
self.idx.contents.value = 0
else:
self.parent.dll.rawGetBlock(ct.byref(self.data), size)
self.idx.contents.value = size.contents.value
return self.getData()


Expand Down Expand Up @@ -2075,7 +2091,10 @@ def getData(self, numRead: typing.Optional[int] = None):
"""
if not numRead:
numRead = self.numRead()


if(self.parent.deviceConfig["MeasMode"] == MeasMode.Histogram.value):
self.parent.logPrint( "getData is not supported for Raw class in MeasMode:", MeasMode(self.parent.deviceConfig["MeasMode"]).name)
return []
return np.lib.stride_tricks.as_strided(self.data, shape=(1, numRead),
strides=(ct.sizeof(self.data._type_) * numRead, ct.sizeof(self.data._type_)))[0]

Expand Down Expand Up @@ -2408,6 +2427,12 @@ def measure(self, acqTime: typing.Optional[int] = 1000, size: typing.Optional[in
If you wish to avoid blocking you can pass waitFinished False and proceed with other code. In order
to check later if the measurement is completed you can use the :meth:`isFinished` function.
The data can be accessed with :meth:`getData`.
Caution
-------
The `Unfold buffer overrun - clearing!` warning or `Unfold Buffer full - waiting!` info means, that data cant be stored
in the allocated memory `size`. Increase the memory `size`, use the non blocking measure or the :meth:`startBlock`
and :meth:`readBlock`!
Parameters
----------
Expand Down Expand Up @@ -2446,6 +2471,9 @@ def measure(self, acqTime: typing.Optional[int] = 1000, size: typing.Optional[in
self.times = ct.ARRAY(ct.c_uint64, size)()
self.channels = ct.ARRAY(ct.c_uint8, size)()
self.idx = ct.pointer(ct.c_uint64(0))
if(self.parent.deviceConfig["MeasMode"] == MeasMode.Histogram.value):
self.parent.logPrint( "measurement is not supported for Unfold class in MeasMode:", MeasMode(self.parent.deviceConfig["MeasMode"]).name)
return False
return self.parent.dll.ufMeasure(acqTime, waitFinished, savePTU, ct.byref(self.times), ct.byref(self.channels), self.idx, ct.c_uint64(size), self.finished)


Expand Down Expand Up @@ -2497,6 +2525,9 @@ def startBlock(self, acqTime: int= 1000, size: int = 134217728, savePTU: typing.
self.storeChannels = ct.ARRAY(ct.c_uint8, size)()
self.times = ct.ARRAY(ct.c_uint64, size)()
self.channels = ct.ARRAY(ct.c_uint8, size)()
if(self.parent.deviceConfig["MeasMode"] == MeasMode.Histogram.value):
self.parent.logPrint( "startBlock is not supported for Unfold class in MeasMode:", MeasMode(self.parent.deviceConfig["MeasMode"]).name)
return False
return self.parent.dll.ufStartBlock(acqTime, savePTU, ct.byref(self.storeTimes), ct.byref(self.storeChannels), ct.c_uint64(size), self.finished)


Expand Down Expand Up @@ -2533,8 +2564,12 @@ def getBlock(self):
"""
size = ct.pointer(ct.c_uint64(0))
self.parent.dll.ufGetBlock(ct.byref(self.times), ct.byref(self.channels), size)
self.idx.contents.value = size.contents.value
if(self.parent.deviceConfig["MeasMode"] == MeasMode.Histogram.value):
self.parent.logPrint( "startBlock is not supported for Unfold class in MeasMode:", MeasMode(self.parent.deviceConfig["MeasMode"]).name)
self.idx.contents.value = 0
else:
self.parent.dll.ufGetBlock(ct.byref(self.times), ct.byref(self.channels), size)
self.idx.contents.value = size.contents.value
return self.getData()


Expand Down Expand Up @@ -3575,18 +3610,19 @@ def measure(self, acqTime: typing.Optional[int] = 1000, waitFinished: typing.Opt
break
"""

if self.isFcs:
self.numBins = self.numIntervals * self.intervalLength
self.data = ct.ARRAY(ct.c_double, 2 * self.numBins)(0)
else:
self.numBins = 2 * self.intervalLength
self.data = ct.ARRAY(ct.c_double, self.numBins)(0)

self.bins = ct.ARRAY(ct.c_double, self.numBins)(0)
if(self.parent.deviceConfig["MeasMode"] == MeasMode.Histogram.value):
self.parent.logPrint( "measurement is not supported for Correlation class in MeasMode:", MeasMode(self.parent.deviceConfig["MeasMode"]).name)
return False

self.bins = ct.ARRAY(ct.c_double, self.numBins)(0)
return self.parent.dll.getCorrelation(acqTime, waitFinished, savePTU, ct.byref(self.data), ct.byref(self.bins), self.finished)


Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added snAPI/__pycache__/Constants.cpython-311.pyc
Binary file not shown.
Binary file added snAPI/__pycache__/Main.cpython-311.pyc
Binary file not shown.
Binary file added snAPI/__pycache__/Utils.cpython-311.pyc
Binary file not shown.
Binary file added snAPI/__pycache__/__init__.cpython-311.pyc
Binary file not shown.
Binary file modified snAPI/snAPI64.dll
Binary file not shown.

0 comments on commit 2b2d1ac

Please sign in to comment.