-
Notifications
You must be signed in to change notification settings - Fork 1
/
usb_Where.html
374 lines (265 loc) · 17.1 KB
/
usb_Where.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Where did all my Sample and Scan objects go????? — xpdAcq 0.5 documentation</title>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="top" title="xpdAcq 0.5 documentation" href="index.html"/>
<link rel="up" title="For XPD Users" href="xpdusers.html"/>
<link rel="next" title="Running scans" href="usb_Running.html"/>
<link rel="prev" title="ScanPlan objects" href="usb_Scan.html"/>
<script src="_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<a href="index.html" class="icon icon-home"> xpdAcq
</a>
<div class="version">
0.5
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul>
<li class="toctree-l1"><a class="reference internal" href="quickstart.html">Quick Start</a></li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="xpdusers.html">For XPD Users</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="sb_overview.html">Overview of xpd acquisition environment</a></li>
<li class="toctree-l2"><a class="reference internal" href="sb_icollection.html">Overview of the bsui+xpdAcq environment</a></li>
<li class="toctree-l2"><a class="reference internal" href="usb_Beamtime.html">Setting up your Beamtime</a></li>
<li class="toctree-l2"><a class="reference internal" href="usb_Experiment.html">Setting up your XPD acuisition objects</a></li>
<li class="toctree-l2"><a class="reference internal" href="usb_Scan.html">ScanPlan objects</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">Where did all my Sample and Scan objects go?????</a></li>
<li class="toctree-l2"><a class="reference internal" href="#bt-list-is-your-friends">bt.list() is your friends</a></li>
<li class="toctree-l2"><a class="reference internal" href="#bt-list-gotchas">bt.list() Gotchas</a></li>
<li class="toctree-l2"><a class="reference internal" href="usb_Running.html">Running scans</a></li>
<li class="toctree-l2"><a class="reference internal" href="usb_QuickAssess.html">Initial assessment of your data</a></li>
<li class="toctree-l2"><a class="reference internal" href="usb_GlobalOptions.html">xpdAcq Configuration</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="beamlinestaff.html">For Beamline Staff</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="troubleshooting.html">Troubleshooting</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="release_note.html">Release Notes</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">xpdAcq</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html">Docs</a> »</li>
<li><a href="xpdusers.html">For XPD Users</a> »</li>
<li>Where did all my Sample and Scan objects go?????</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/usb_Where.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="where-did-all-my-sample-and-scan-objects-go">
<span id="usb-where"></span><h1>Where did all my Sample and Scan objects go?????<a class="headerlink" href="#where-did-all-my-sample-and-scan-objects-go" title="Permalink to this headline">¶</a></h1>
<p>You just spent hours typing in metadata and creating
<a class="reference internal" href="usb_Experiment.html#usb-experiment"><span class="std std-ref">sample</span></a> and <a class="reference internal" href="usb_Scan.html#usb-scan"><span class="std std-ref">scan</span></a>
objects, and now they have suddenly disappeared! This
is a disaster!</p>
<p>As Douglas Adams taught us <cite>DON’T PANIC</cite> . This is actually
<cite>normal</cite> (or at least <cite>expected</cite> ) behavior in xpdAcq. Remember that
one of the design goals of the software project was to minimize
users’ typing. The design had to take into account that the
collection <code class="docutils literal"><span class="pre">ipython</span></code> environment is not so stable
(e.g., see <a class="reference internal" href="troubleshooting.html#troubleshooting"><span class="std std-ref">Troubleshooting</span></a> ) and we should expect periodic
restarts of it. How bad if we had to retype our metadata every
time? So every time you create an xpdAcq acquisition object,
the details are saved to a file on the local hard-drive. When
<code class="docutils literal"><span class="pre">bsui</span></code> is run, the main <code class="docutils literal"><span class="pre">bt</span></code> object (if it exists) is
automatically reloaded, but not the other acquisition objects.
But don’t worry, they are all safe and sound.</p>
</div>
<div class="section" id="bt-list-is-your-friends">
<span id="usb-bt-list"></span><h1>bt.list() is your friends<a class="headerlink" href="#bt-list-is-your-friends" title="Permalink to this headline">¶</a></h1>
<p>To see what xpdAcquire acquisition objects you have available
to you, type <code class="docutils literal"><span class="pre">bt.list()</span></code> . This lists the name and type of all
the acquisition objects that are on the hard-drive and available
to you....your objects: e.g.,</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">bt</span><span class="o">.</span><span class="n">list</span><span class="p">()</span>
<span class="go">ScanPlans:</span>
<span class="go">0: 'ct_5'</span>
<span class="go">1: 'ct_30'</span>
<span class="go">2: 'ct_1'</span>
<span class="go">3: 'ct_10'</span>
<span class="go">4: 'ct_60'</span>
<span class="go">5: 'ct_0.1'</span>
<span class="go">Samples:</span>
<span class="go">0: Ni</span>
<span class="go">1: TiO2</span>
<span class="go">2: GaAs</span>
<span class="go">3: In0.5Ga0.5As</span>
<span class="go">4: In0.25Ga0.75As</span>
<span class="go">5: In0.75Ga0.25As</span>
<span class="go">6: InA</span>
</pre></div>
</div>
<p>so they are all there, and we can get them, but we can no longer refer to them by the
assignment we used when we created them</p>
<p>To get them, we can explicitly reload them again or just use <strong>index</strong> of this object.
For example, consider the following sequence of code blocks:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">s1</span>
<span class="go">---------------------------------------------------------------------------</span>
<span class="go">NameError Traceback (most recent call last)</span>
<span class="go"><ipython-input-5-51081833a770> in <module>()</span>
<span class="go">----> 1 s1</span>
<span class="go">NameError: name 's1' is not defined</span>
</pre></div>
</div>
<p>Oh no, my <code class="docutils literal"><span class="pre">s1</span></code> sample object, which as my sample named <cite>GaAs</cite> , has disappeared! <code class="docutils literal"><span class="pre">bt.list()</span></code> to the rescue...</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">bt</span><span class="o">.</span><span class="n">list</span><span class="p">()</span>
<span class="go">ScanPlans:</span>
<span class="go">0: 'ct_5'</span>
<span class="go">1: 'ct_30'</span>
<span class="go">2: 'ct_1'</span>
<span class="go">3: 'ct_10'</span>
<span class="go">4: 'ct_60'</span>
<span class="go">5: 'ct_0.1'</span>
<span class="go">Samples:</span>
<span class="go">0: Ni</span>
<span class="go">1: TiO2</span>
<span class="go">2: GaAs</span>
<span class="go">3: In0.5Ga0.5As</span>
<span class="go">4: In0.25Ga0.75As</span>
<span class="go">5: In0.75Ga0.25As</span>
<span class="go">6: InA</span>
</pre></div>
</div>
<p>That’s it with a list index of 2, inside the Samples category. type object called.
Just to be sane, let’s reload it. We can give it any name, it doesn’t have to be
the same name as last time, so let’s reload it as <code class="docutils literal"><span class="pre">s1_again</span></code> :</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">s1_again</span> <span class="o">=</span> <span class="n">bt</span><span class="o">.</span><span class="n">samples</span><span class="p">[</span><span class="s1">'GaAs'</span><span class="p">]</span> <span class="c1"># e.g., the sample name is GaAs</span>
<span class="gp">>>> </span><span class="n">s1_again</span>
<span class="go">{'bt_experimenters': ['Tim', 'Liu'],</span>
<span class="go"> 'bt_piLast': 'Billinge',</span>
<span class="go"> 'bt_safN': '300564',</span>
<span class="go"> 'bt_uid': 'fbb381c3',</span>
<span class="go"> 'bt_wavelength': 0.1832,</span>
<span class="go"> 'sa_uid': '4557b649',</span>
<span class="go"> 'sample_composition': {'As': 1.0, 'Ga': 1.0},</span>
<span class="go"> 'sample_name': 'GaAs'}</span>
</pre></div>
</div>
<p>As you get used to this, you will realize that you don’t actually have to reload
it at all, and can just refer directly to it.</p>
<p>You see that the <em>indexing method</em> acts exactly like (in fact it <cite>is</cite> ) the <code class="docutils literal"><span class="pre">#</span></code> th object
in the list returned by <code class="docutils literal"><span class="pre">bt.list()</span></code> . And it persists for your entire beamtime,
even if you hang up the entire software and have to have it restarted by one of the
IT guys.</p>
<p>Just remember. First type <code class="docutils literal"><span class="pre">bt.list()</span></code> to locate the object you want, then use
object index to reference it based on categories. For example if I want to interrogate metadata
from <code class="docutils literal"><span class="pre">ScanPlan</span></code> object <code class="docutils literal"><span class="pre">ct_5</span></code>, you can do:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">bt</span><span class="o">.</span><span class="n">scanplans</span><span class="o">.</span><span class="n">get_md</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
<span class="go">INFO: requested exposure time = 5 - > computed exposure time= 5.0</span>
<span class="go">{'detectors': ['pe1c'],</span>
<span class="go"> 'num_steps': 1,</span>
<span class="go"> 'plan_args': {'detectors': ['PE1C(name=pe1c)'], 'num': 1},</span>
<span class="go"> 'plan_name': 'count',</span>
<span class="go"> 'sp_computed_exposure': 5.0,</span>
<span class="go"> 'sp_num_frames': 50.0,</span>
<span class="go"> 'sp_plan_name': 'ct',</span>
<span class="go"> 'sp_requested_exposure': 5,</span>
<span class="go"> 'sp_time_per_frame': 0.1,</span>
<span class="go"> 'sp_type': 'ct',</span>
<span class="go"> 'sp_uid': 'bc3886a2-793a-4ee2-8269-a2ccb3030342'}</span>
</pre></div>
</div>
<p>Don’t forget the <code class="docutils literal"><span class="pre">bt.list()</span></code> first because your object may change its position
in the list over time.</p>
<p>As you probably noticed, we have <code class="docutils literal"><span class="pre">bt.list()</span></code> prints out two categories,
<code class="docutils literal"><span class="pre">ScanPlans</span></code> and <code class="docutils literal"><span class="pre">Samples</span></code>. The whole purpose of this is to make it easy to reference
desired objects.</p>
</div>
<div class="section" id="bt-list-gotchas">
<span id="usb-gotchas"></span><h1>bt.list() Gotchas<a class="headerlink" href="#bt-list-gotchas" title="Permalink to this headline">¶</a></h1>
<p>Once you get used to this design we hope you will like it, but there are a
couple of important <cite>Gotchas</cite> that you should bear in mind that could lead to
confusion until you get used to them.</p>
<blockquote>
<div><ol class="arabic">
<li><p class="first">If you create a <cite>new</cite> object with the same type and name as an existing one, the existing one will be <strong>OVERWRITTEN</strong> by the new one! You will lose the old one forever.</p>
<p>This is actually a feature of the code (we want each object to be unique and the only thing that makes it unique from one <code class="docutils literal"><span class="pre">collection</span></code> session to the next is its name and type).
But please be careful about your naming! Why is it a feature? You can use this to update an object by redefining it with the same name.</p>
</li>
<li><p class="first">At the time of writing, our xpdacq objects incorporate metadata from higher
in the stack (e.g., <code class="docutils literal"><span class="pre">Sample</span></code> inheriting <code class="docutils literal"><span class="pre">Beamtime</span></code> metadata) dynamically.
Any change on <code class="docutils literal"><span class="pre">Beamtime</span></code> metadata will automatically propagate down
to all <code class="docutils literal"><span class="pre">Sample</span></code> and <code class="docutils literal"><span class="pre">ScanPlan</span></code> objects.</p>
</li>
</ol>
</div></blockquote>
<p>go to <a class="reference internal" href="usb_Scan.html#usb-scan"><span class="std std-ref">ScanPlan objects</span></a></p>
<p>go to <a class="reference internal" href="usb_Running.html#usb-running"><span class="std std-ref">Running scans</span></a></p>
<p>return to <a class="reference internal" href="xpdusers.html#xpdu"><span class="std std-ref">For XPD Users</span></a></p>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="usb_Running.html" class="btn btn-neutral float-right" title="Running scans" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="usb_Scan.html" class="btn btn-neutral" title="ScanPlan objects" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
© Copyright (c) 2016 trustees of Columbia University in the City of New York.
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'0.5',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
});
</script>
</body>
</html>