Skip to content

Commit

Permalink
Generated gh-pages for commit 0435245
Browse files Browse the repository at this point in the history
Author: William H.P. Nielsen <whpn@mailbox.org>

    fix: protect threading users against clutter (#771)
  • Loading branch information
Documentation Bot committed Sep 29, 2017
1 parent dbdb79b commit 938ec52
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 10 deletions.
23 changes: 22 additions & 1 deletion _modules/qcodes/actions.html
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@ <h1>Source code for qcodes.actions</h1><div class="highlight"><pre>
<span class="n">_NO_SNAPSHOT</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;type&#39;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span> <span class="s1">&#39;description&#39;</span><span class="p">:</span> <span class="s1">&#39;Action without snapshot&#39;</span><span class="p">}</span>


<span class="c1"># exception when threading is attempted used to simultaneously</span>
<span class="c1"># query the same instrument for several values</span>
<span class="k">class</span> <span class="nc">UnsafeThreadingException</span><span class="p">(</span><span class="ne">Exception</span><span class="p">):</span>
<span class="k">pass</span>


<span class="k">def</span> <span class="nf">_actions_snapshot</span><span class="p">(</span><span class="n">actions</span><span class="p">,</span> <span class="n">update</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Make a list of snapshots from a list of actions.&quot;&quot;&quot;</span>
<span class="n">snapshot</span> <span class="o">=</span> <span class="p">[]</span>
Expand Down Expand Up @@ -278,9 +284,13 @@ <h1>Source code for qcodes.actions</h1><div class="highlight"><pre>
<span class="bp">self</span><span class="o">.</span><span class="n">getters</span> <span class="o">=</span> <span class="p">[]</span>
<span class="bp">self</span><span class="o">.</span><span class="n">param_ids</span> <span class="o">=</span> <span class="p">[]</span>
<span class="bp">self</span><span class="o">.</span><span class="n">composite</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">paramcheck</span> <span class="o">=</span> <span class="p">[]</span> <span class="c1"># list to check if parameters are unique</span>
<span class="k">for</span> <span class="n">param</span><span class="p">,</span> <span class="n">action_indices</span> <span class="ow">in</span> <span class="n">params_indices</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">getters</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">param</span><span class="o">.</span><span class="n">get</span><span class="p">)</span>

<span class="k">if</span> <span class="n">param</span><span class="o">.</span><span class="n">_instrument</span><span class="p">:</span>
<span class="n">paramcheck</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">param</span><span class="p">,</span> <span class="n">param</span><span class="o">.</span><span class="n">_instrument</span><span class="p">))</span>

<span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">param</span><span class="p">,</span> <span class="s1">&#39;names&#39;</span><span class="p">):</span>
<span class="n">part_ids</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">param</span><span class="o">.</span><span class="n">names</span><span class="p">)):</span>
Expand All @@ -293,6 +303,17 @@ <h1>Source code for qcodes.actions</h1><div class="highlight"><pre>
<span class="bp">self</span><span class="o">.</span><span class="n">param_ids</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">param_id</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">composite</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="kc">False</span><span class="p">)</span>

<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">use_threads</span><span class="p">:</span>
<span class="n">insts</span> <span class="o">=</span> <span class="p">[</span><span class="n">p</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">paramcheck</span><span class="p">]</span>
<span class="k">if</span> <span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="nb">set</span><span class="p">(</span><span class="n">insts</span><span class="p">))</span> <span class="o">!=</span> <span class="nb">len</span><span class="p">(</span><span class="n">insts</span><span class="p">)):</span>
<span class="n">duplicates</span> <span class="o">=</span> <span class="p">[</span><span class="n">p</span> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">paramcheck</span> <span class="k">if</span> <span class="n">insts</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="n">p</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">]</span>
<span class="k">raise</span> <span class="n">UnsafeThreadingException</span><span class="p">(</span><span class="s1">&#39;Can not use threading to &#39;</span>
<span class="s1">&#39;read &#39;</span>
<span class="s1">&#39;several things from the same &#39;</span>
<span class="s1">&#39;instrument. Specifically, you &#39;</span>
<span class="s1">&#39;asked for&#39;</span>
<span class="s1">&#39; </span><span class="si">{}</span><span class="s1">.&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">duplicates</span><span class="p">))</span>

<span class="k">def</span> <span class="nf">__call__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">loop_indices</span><span class="p">,</span> <span class="o">**</span><span class="n">ignore_kwargs</span><span class="p">):</span>
<span class="n">out_dict</span> <span class="o">=</span> <span class="p">{}</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">use_threads</span><span class="p">:</span>
Expand Down Expand Up @@ -331,7 +352,7 @@ <h1>Source code for qcodes.actions</h1><div class="highlight"><pre>

<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Loop action that breaks out of the loop if a condition is truthy.</span>
<span class="sd"> </span>

<span class="sd"> Args:</span>
<span class="sd"> condition (callable): a callable taking no arguments.</span>
<span class="sd"> Can be a simple function that returns truthy when it&#39;s time to quit</span>
Expand Down
2 changes: 1 addition & 1 deletion api/generated/qcodes.instrument_drivers.Advantech.html
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this
<p>Tested with driver version 3.1.10.0 and ddl version 3.1.12.1.</p>
<dl class="attribute">
<dt id="qcodes.instrument_drivers.Advantech.PCIE_1751.Advantech_PCIE_1751.ERRORMSG">
<code class="descname">ERRORMSG</code><em class="property"> = {0: 'The operation is completed successfully.', 2684354560: 'The interrupt resource is not available.', 2684354561: 'The parameter is out of the range.', 2684354562: 'The property value is out of range.', 2684354563: 'The property value is not supported.', 2684354564: 'The property value conflicts with the current state.', 2684354565: 'The value range of all channels in a group should be same, such as 4~20mA of PCI-1724.', 3758096384: &quot;The handle is NULL or its type doesn't match the required operation.&quot;, 3758096385: 'The parameter value is out of range.', 3758096386: 'The parameter value is not supported.', 3758096387: 'The parameter value format is not the expected.', 3758096388: 'Not enough memory is available to complete the operation.', 3758096389: 'The data buffer is null.', 3758096390: 'The data buffer is too small for the operation.', 3758096391: 'The data length exceeded the limitation.', 3758096392: 'The required function is not supported.', 3758096393: 'The required event is not supported.', 3758096394: 'The required property is not supported.', 3758096395: 'The required property is read-only.', 3758096396: 'The specified property value conflicts with the current state.', 3758096397: 'The specified property value is out of range.', 3758096398: 'The specified property value is not supported.', 3758096399: &quot;The handle hasn't own the privilege of the operation the user wanted.&quot;, 3758096400: 'The required privilege is not available because someone else had own it.', 3758096401: 'The driver of specified device was not found.', 3758096402: 'The driver version of the specified device mismatched.', 3758096403: 'The loaded driver count exceeded the limitation.', 3758096404: 'The device is not opened.', 3758096405: 'The required device does not exist.', 3758096406: 'The required device is unrecognized by driver.', 3758096407: 'The configuration data of the specified device is lost or unavailable.', 3758096408: &quot;The function is not initialized and can't be started.&quot;, 3758096409: 'The function is busy.', 3758096410: 'The interrupt resource is not available.', 3758096411: 'The DMA channel is not available.', 3758096412: 'Time out when reading/writing the device.', 3758096413: 'The given signature does not match with the device current one.', 3758096414: 'The function cannot be executed while the buffered AI is running.', 3758096415: 'The value range is not available in single-ended mode.', 3758161919: 'Undefined error.'}</em><a class="headerlink" href="#qcodes.instrument_drivers.Advantech.PCIE_1751.Advantech_PCIE_1751.ERRORMSG" title="Permalink to this definition"></a></dt>
<code class="descname">ERRORMSG</code><em class="property"> = {0: 'The operation is completed successfully.', 2684354560: 'The interrupt resource is not available.', 2684354562: 'The property value is out of range.', 2684354563: 'The property value is not supported.', 2684354564: 'The property value conflicts with the current state.', 2684354565: 'The value range of all channels in a group should be same, such as 4~20mA of PCI-1724.', 3758096384: &quot;The handle is NULL or its type doesn't match the required operation.&quot;, 2684354561: 'The parameter is out of the range.', 3758096392: 'The required function is not supported.', 3758096393: 'The required event is not supported.', 3758096394: 'The required property is not supported.', 3758096395: 'The required property is read-only.', 3758096396: 'The specified property value conflicts with the current state.', 3758096386: 'The parameter value is not supported.', 3758096398: 'The specified property value is not supported.', 3758096397: 'The specified property value is out of range.', 3758096400: 'The required privilege is not available because someone else had own it.', 3758096401: 'The driver of specified device was not found.', 3758096402: 'The driver version of the specified device mismatched.', 3758096387: 'The parameter value format is not the expected.', 3758096404: 'The device is not opened.', 3758096405: 'The required device does not exist.', 3758096406: 'The required device is unrecognized by driver.', 3758096407: 'The configuration data of the specified device is lost or unavailable.', 3758096408: &quot;The function is not initialized and can't be started.&quot;, 3758096388: 'Not enough memory is available to complete the operation.', 3758096410: 'The interrupt resource is not available.', 3758096399: &quot;The handle hasn't own the privilege of the operation the user wanted.&quot;, 3758096412: 'Time out when reading/writing the device.', 3758096413: 'The given signature does not match with the device current one.', 3758096414: 'The function cannot be executed while the buffered AI is running.', 3758096389: 'The data buffer is null.', 3758096411: 'The DMA channel is not available.', 3758096385: 'The parameter value is out of range.', 3758096390: 'The data buffer is too small for the operation.', 3758096391: 'The data length exceeded the limitation.', 3758096403: 'The loaded driver count exceeded the limitation.', 3758096409: 'The function is busy.', 3758096415: 'The value range is not available in single-ended mode.', 3758161919: 'Undefined error.'}</em><a class="headerlink" href="#qcodes.instrument_drivers.Advantech.PCIE_1751.Advantech_PCIE_1751.ERRORMSG" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="method">
Expand Down
4 changes: 2 additions & 2 deletions api/generated/qcodes.instrument_drivers.QDev.html
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this

<dl class="attribute">
<dt id="qcodes.instrument_drivers.QDev.QDac.QDac.voltage_range_status">
<code class="descname">voltage_range_status</code><em class="property"> = {'X 1': 10, 'X 0.1': 1}</em><a class="headerlink" href="#qcodes.instrument_drivers.QDev.QDac.QDac.voltage_range_status" title="Permalink to this definition"></a></dt>
<code class="descname">voltage_range_status</code><em class="property"> = {'X 0.1': 1, 'X 1': 10}</em><a class="headerlink" href="#qcodes.instrument_drivers.QDev.QDac.QDac.voltage_range_status" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="method">
Expand Down Expand Up @@ -382,7 +382,7 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this

<dl class="attribute">
<dt id="qcodes.instrument_drivers.QDev.QDac_channels.QDac.voltage_range_status">
<code class="descname">voltage_range_status</code><em class="property"> = {'X 1': 10, 'X 0.1': 1}</em><a class="headerlink" href="#qcodes.instrument_drivers.QDev.QDac_channels.QDac.voltage_range_status" title="Permalink to this definition"></a></dt>
<code class="descname">voltage_range_status</code><em class="property"> = {'X 0.1': 1, 'X 1': 10}</em><a class="headerlink" href="#qcodes.instrument_drivers.QDev.QDac_channels.QDac.voltage_range_status" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="method">
Expand Down
4 changes: 2 additions & 2 deletions api/generated/qcodes.instrument_drivers.signal_hound.html
Original file line number Diff line number Diff line change
Expand Up @@ -318,12 +318,12 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this

<dl class="attribute">
<dt id="qcodes.instrument_drivers.signal_hound.USB_SA124B.SignalHound_USB_SA124B.saStatus">
<code class="descname">saStatus</code><em class="property"> = {'saUnknownErr': -666, 'saFrequencyRangeErr': -99, 'saInvalidDetectorErr': -95, 'saInvalidScaleErr': -94, 'saBandwidthErr': -91, 'saExternalReferenceNotFound': -89, 'saOvenColdErr': -20, 'saInternetErr': -12, 'saUSBCommErr': -11, 'saTrackingGeneratorNotFound': -10, 'saDeviceNotIdleErr': -9, 'saDeviceNotFoundErr': -8, 'saInvalidModeErr': -7, 'saNotConfiguredErr': -6, 'saDeviceNotConfiguredErr': -6, 'saTooManyDevicesErr': -5, 'saInvalidParameterErr': -4, 'saDeviceNotOpenErr': -3, 'saInvalidDeviceErr': -2, 'saNullPtrErr': -1, 'saNoError': 0, 'saNoCorrections': 1, 'saCompressionWarning': 2, 'saParameterClamped': 3, 'saBandwidthClamped': 4}</em><a class="headerlink" href="#qcodes.instrument_drivers.signal_hound.USB_SA124B.SignalHound_USB_SA124B.saStatus" title="Permalink to this definition"></a></dt>
<code class="descname">saStatus</code><em class="property"> = {'saBandwidthErr': -91, 'saDeviceNotOpenErr': -3, 'saInvalidDeviceErr': -2, 'saTooManyDevicesErr': -5, 'saParameterClamped': 3, 'saInvalidModeErr': -7, 'saInvalidParameterErr': -4, 'saInvalidScaleErr': -94, 'saDeviceNotFoundErr': -8, 'saInvalidDetectorErr': -95, 'saCompressionWarning': 2, 'saDeviceNotConfiguredErr': -6, 'saNullPtrErr': -1, 'saInternetErr': -12, 'saOvenColdErr': -20, 'saNoError': 0, 'saUSBCommErr': -11, 'saDeviceNotIdleErr': -9, 'saUnknownErr': -666, 'saExternalReferenceNotFound': -89, 'saFrequencyRangeErr': -99, 'saNoCorrections': 1, 'saBandwidthClamped': 4, 'saTrackingGeneratorNotFound': -10, 'saNotConfiguredErr': -6}</em><a class="headerlink" href="#qcodes.instrument_drivers.signal_hound.USB_SA124B.SignalHound_USB_SA124B.saStatus" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="qcodes.instrument_drivers.signal_hound.USB_SA124B.SignalHound_USB_SA124B.saStatus_inverted">
<code class="descname">saStatus_inverted</code><em class="property"> = {-666: 'saUnknownErr', -99: 'saFrequencyRangeErr', -95: 'saInvalidDetectorErr', -94: 'saInvalidScaleErr', -91: 'saBandwidthErr', -89: 'saExternalReferenceNotFound', -20: 'saOvenColdErr', -12: 'saInternetErr', -11: 'saUSBCommErr', -10: 'saTrackingGeneratorNotFound', -9: 'saDeviceNotIdleErr', -8: 'saDeviceNotFoundErr', -7: 'saInvalidModeErr', -6: 'saDeviceNotConfiguredErr', -5: 'saTooManyDevicesErr', -4: 'saInvalidParameterErr', -3: 'saDeviceNotOpenErr', -2: 'saInvalidDeviceErr', -1: 'saNullPtrErr', 0: 'saNoError', 1: 'saNoCorrections', 2: 'saCompressionWarning', 3: 'saParameterClamped', 4: 'saBandwidthClamped'}</em><a class="headerlink" href="#qcodes.instrument_drivers.signal_hound.USB_SA124B.SignalHound_USB_SA124B.saStatus_inverted" title="Permalink to this definition"></a></dt>
<code class="descname">saStatus_inverted</code><em class="property"> = {0: 'saNoError', 1: 'saNoCorrections', 2: 'saCompressionWarning', 3: 'saParameterClamped', 4: 'saBandwidthClamped', -99: 'saFrequencyRangeErr', -95: 'saInvalidDetectorErr', -94: 'saInvalidScaleErr', -91: 'saBandwidthErr', -666: 'saUnknownErr', -89: 'saExternalReferenceNotFound', -20: 'saOvenColdErr', -12: 'saInternetErr', -2: 'saInvalidDeviceErr', -10: 'saTrackingGeneratorNotFound', -9: 'saDeviceNotIdleErr', -8: 'saDeviceNotFoundErr', -7: 'saInvalidModeErr', -6: 'saNotConfiguredErr', -5: 'saTooManyDevicesErr', -4: 'saInvalidParameterErr', -3: 'saDeviceNotOpenErr', -1: 'saNullPtrErr', -11: 'saUSBCommErr'}</em><a class="headerlink" href="#qcodes.instrument_drivers.signal_hound.USB_SA124B.SignalHound_USB_SA124B.saStatus_inverted" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="method">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3.5/library/stdtypes.html#str" title="(in Python v3.5)"><em>str</em></a>) – The name of the parameter</li>
<li><strong>instrument</strong> (<a class="reference internal" href="#module-qcodes.instrument_drivers.stanford_research.SR830" title="qcodes.instrument_drivers.stanford_research.SR830"><em>SR830</em></a>) – The parent instrument</li>
<li><strong>instrument</strong> (<a class="reference internal" href="#qcodes.instrument_drivers.stanford_research.SR830.SR830" title="qcodes.instrument_drivers.stanford_research.SR830.SR830"><em>SR830</em></a>) – The parent instrument</li>
<li><strong>channel</strong> (<a class="reference external" href="https://docs.python.org/3.5/library/functions.html#int" title="(in Python v3.5)"><em>int</em></a>) – The relevant channel (1 or 2). The name should
should match this.</li>
</ul>
Expand Down
Loading

0 comments on commit 938ec52

Please sign in to comment.