-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathcfa.html
More file actions
479 lines (430 loc) · 15.9 KB
/
Copy pathcfa.html
File metadata and controls
479 lines (430 loc) · 15.9 KB
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
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Python information for CfA — Python4Astronomers 2.0 documentation</title>
<link rel="stylesheet" href="../_static/bootstrap-astropy.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '2.0',
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="../_static/sidebar.js"></script>
<link rel="top" title="Python4Astronomers 2.0 documentation" href="../index.html" />
<link rel="up" title="Local information" href="local.html" />
<link rel="next" title="gll_psc_v08.fit" href="../astropy/data/README.html" />
<link rel="prev" title="Local information" href="local.html" />
<link href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:200,600' rel='stylesheet' type='text/css'>
<script type="text/javascript" src="../_static/copybutton.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".flip0").click(function(){
$(".panel0").slideToggle("normal");
});
$(".flip1").click(function(){
$(".panel1").slideToggle("normal");
});
$(".flip2").click(function(){
$(".panel2").slideToggle("normal");
});
$(".flip3").click(function(){
$(".panel3").slideToggle("normal");
});
$(".flip4").click(function(){
$(".panel4").slideToggle("normal");
});
$(".flip5").click(function(){
$(".panel5").slideToggle("normal");
});
$(".flip6").click(function(){
$(".panel6").slideToggle("normal");
});
$(".flip7").click(function(){
$(".panel7").slideToggle("normal");
});
$(".flip8").click(function(){
$(".panel8").slideToggle("normal");
});
$(".flip9").click(function(){
$(".panel9").slideToggle("normal");
});
});
</script>
<style type="text/css">
div.panel0,p.flip0
{
font-size: 0.9em;
margin: 0;
padding: 0.1em 0 0.1em 0.5em;
border-bottom: 1px solid #86989B;
}
p.flip0
{
color: white;
font-weight: bold;
background-color: #AFC1C4;
}
div.panel0
{
display:none;
}
div.panel1,p.flip1
{
font-size: 0.9em;
margin: 0;
padding: 0.1em 0 0.1em 0.5em;
border-bottom: 1px solid #86989B;
}
p.flip1
{
color: white;
font-weight: bold;
background-color: #AFC1C4;
}
div.panel1
{
display:none;
}
div.panel2,p.flip2
{
font-size: 0.9em;
margin: 0;
padding: 0.1em 0 0.1em 0.5em;
border-bottom: 1px solid #86989B;
}
p.flip2
{
color: white;
font-weight: bold;
background-color: #AFC1C4;
}
div.panel2
{
display:none;
}
div.panel3,p.flip3
{
font-size: 0.9em;
margin: 0;
padding: 0.1em 0 0.1em 0.5em;
border-bottom: 1px solid #86989B;
}
p.flip3
{
color: white;
font-weight: bold;
background-color: #AFC1C4;
}
div.panel3
{
display:none;
}
div.panel4,p.flip4
{
font-size: 0.9em;
margin: 0;
padding: 0.1em 0 0.1em 0.5em;
border-bottom: 1px solid #86989B;
}
p.flip4
{
color: white;
font-weight: bold;
background-color: #AFC1C4;
}
div.panel4
{
display:none;
}
div.panel5,p.flip5
{
font-size: 0.9em;
margin: 0;
padding: 0.1em 0 0.1em 0.5em;
border-bottom: 1px solid #86989B;
}
p.flip5
{
color: white;
font-weight: bold;
background-color: #AFC1C4;
}
div.panel5
{
display:none;
}
div.panel6,p.flip6
{
font-size: 0.9em;
margin: 0;
padding: 0.1em 0 0.1em 0.5em;
border-bottom: 1px solid #86989B;
}
p.flip6
{
color: white;
font-weight: bold;
background-color: #AFC1C4;
}
div.panel6
{
display:none;
}
div.panel7,p.flip7
{
font-size: 0.9em;
margin: 0;
padding: 0.1em 0 0.1em 0.5em;
border-bottom: 1px solid #86989B;
}
p.flip7
{
color: white;
font-weight: bold;
background-color: #AFC1C4;
}
div.panel7
{
display:none;
}
div.panel8,p.flip8
{
font-size: 0.9em;
margin: 0;
padding: 0.1em 0 0.1em 0.5em;
border-bottom: 1px solid #86989B;
}
p.flip8
{
color: white;
font-weight: bold;
background-color: #AFC1C4;
}
div.panel8
{
display:none;
}
div.panel9,p.flip9
{
font-size: 0.9em;
margin: 0;
padding: 0.1em 0 0.1em 0.5em;
border-bottom: 1px solid #86989B;
}
p.flip9
{
color: white;
font-weight: bold;
background-color: #AFC1C4;
}
div.panel9
{
display:none;
}
</style>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-18709417-2']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body role="document">
<div class="topbar">
<a class="brand" title="Documentation Home" href="../index.html"><span id="logotext1">python</span><span id="logotext2">4</span><span id="logotext3">astronomers</span></a>
<ul>
<li><a class="homelink" title="Astropy Homepage" href="http://www.astropy.org"></a></li>
</ul>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right">
<a href="../astropy/data/README.html" title="gll_psc_v08.fit">
next »
</a>
</li>
<li class="right">
<a href="local.html" title="Local information">
« previous
</a>
|
</li>
<li>
<a href="../index.html">Python4Astronomers 2.0 documentation</a>
»
</li>
<li><a href="local.html" accesskey="U">Local information</a> »</li>
<li>Python information for CfA</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="python-information-for-cfa">
<h1>Python information for CfA<a class="headerlink" href="#python-information-for-cfa" title="Permalink to this headline">¶</a></h1>
<p>These instructions apply to the Harvard/Smithsonian Center for Astrophysics.</p>
<div class="section" id="using-python-the-head-network">
<h2>Using Python the HEAD network<a class="headerlink" href="#using-python-the-head-network" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="using-python-on-the-cf-network">
<h2>Using Python on the CF network<a class="headerlink" href="#using-python-on-the-cf-network" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="scipy-matplotlib-and-the-rest-in-ciao-on-head">
<h2>SciPy, matplotlib (and the rest) in CIAO on HEAD<a class="headerlink" href="#scipy-matplotlib-and-the-rest-in-ciao-on-head" title="Permalink to this headline">¶</a></h2>
<p>First get into CIAO in the usual way:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>source /soft/ciao/bin/ciao.csh # tcsh
. /soft/ciao/bin/ciao.sh # bash
</pre></div>
</div>
<p>Now set your local installation prefix to a directory of your choosing where
you have write permission and make some directories:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>set prefix=$HOME/ciaopy # tcsh
prefix=$HOME/ciaopy # bash
mkdir -p $prefix/bin
mkdir -p $prefix/build
mkdir -p $prefix/include
mkdir -p $prefix/lib
</pre></div>
</div>
<p>Set up a couple of paths. You’ll probably want to do something similar to this
path setup in your shell startup file:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span># tcsh
setenv PATH $prefix/bin:$PATH # tcsh
setenv PYTHONPATH $prefix/lib/python2.7/site-packages
# bash
export PATH=$prefix/bin:$PATH
export PYTHONPATH=$prefix/lib/python2.7/site-packages
mkdir -p $PYTHONPATH
</pre></div>
</div>
<p>Now copy binary versions of the numerical libraries that are needed by SciPy.
These have only been verified to work on CentOS-5 on the HEAD network:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>cd $prefix/lib
tar xf /proj/sot/ska/export/lapack_blas_atlas_x86-64.tar.gz
</pre></div>
</div>
<p>Now go to the build directory and untar the source distributions for the SciPy and distribute packages:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>cd $prefix/build
tar xf /proj/sot/ska/pkgs/scipy-0.10.0.tar.gz
tar xf /proj/sot/ska/pkgs/distribute-0.6.19.tar.gz
</pre></div>
</div>
<p>First build and install <code class="docutils literal"><span class="pre">distribute</span></code>. This provides <code class="docutils literal"><span class="pre">setuptools</span></code> and
<code class="docutils literal"><span class="pre">easy_install</span></code>. It turns out that in this exercise <code class="docutils literal"><span class="pre">easy_install</span></code> works
better than <code class="docutils literal"><span class="pre">pip</span></code> because it provides a <code class="docutils literal"><span class="pre">--prefix</span></code> option that works.</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>cd $prefix/build/distribute-0.6.19
ciaorun python setup.py install --prefix=$prefix
</pre></div>
</div>
<p>Now set up the configuration file to build SciPy from source:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>cd $prefix/build/scipy-0.10.0
rm -f site.cfg
echo "[DEFAULT]" > site.cfg
echo "library_dirs = ${prefix}/lib" >> site.cfg
echo "include_dirs = ${prefix}/include" >> site.cfg
echo "[lapack_opt]" >> site.cfg
echo "libraries = lapack, f77blas, cblas, atlas" >> site.cfg
echo "[fftw]" >> site.cfg
echo "libraries = fftw3" >> site.cfg
</pre></div>
</div>
<p>Start building and go get a coffee or read a paper for a little while, hopefully less than a half hour:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>rm -f build.log install.log
ciaorun python setup.py build --fcompiler=gnu95 >& build.log
ciaorun python setup.py install --prefix=$prefix >& install.log
</pre></div>
</div>
<p>Inspect <code class="docutils literal"><span class="pre">build.log</span></code> and <code class="docutils literal"><span class="pre">install.log</span></code> for errors (e.g.
<code class="docutils literal"><span class="pre">grep</span> <span class="pre">-i</span> <span class="pre">error</span> <span class="pre">build.log</span></code>). If this looks OK then change to
a different directory and start up <code class="docutils literal"><span class="pre">sherpa</span></code> or <code class="docutils literal"><span class="pre">chips</span></code>:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>cd $prefix/build
sherpa
</pre></div>
</div>
<p>Now within <code class="docutils literal"><span class="pre">sherpa</span></code> do:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">scipy</span>
<span class="kn">import</span> <span class="nn">scipy.linalg</span>
<span class="k">print</span><span class="p">(</span><span class="n">scipy</span><span class="o">.</span><span class="n">__version__</span><span class="p">)</span>
<span class="k">print</span><span class="p">(</span><span class="n">scipy</span><span class="o">.</span><span class="n">linalg</span><span class="o">.</span><span class="n">eig</span><span class="p">([[</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">],[</span><span class="mi">3</span><span class="p">,</span><span class="mi">4</span><span class="p">]]))</span>
</pre></div>
</div>
<p>Now quit and install the rest:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>ciaorun easy_install --verbose --prefix=$prefix matplotlib
ciaorun easy_install --verbose --prefix=$prefix asciitable
ciaorun easy_install --verbose --prefix=$prefix pywcs
ciaorun easy_install --verbose --prefix=$prefix pyfits
ciaorun easy_install --verbose --prefix=$prefix atpy
ciaorun easy_install --verbose --prefix=$prefix aplpy
ciaorun easy_install --verbose --prefix=$prefix nose
</pre></div>
</div>
<p>Once again fire up <code class="docutils literal"><span class="pre">sherpa</span></code> or <code class="docutils literal"><span class="pre">chips</span></code> and do:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">numpy</span> <span class="kn">as</span> <span class="nn">np</span>
<span class="kn">import</span> <span class="nn">matplotlib</span>
<span class="n">matplotlib</span><span class="o">.</span><span class="n">use</span><span class="p">(</span><span class="s1">'TkAgg'</span><span class="p">)</span>
<span class="kn">import</span> <span class="nn">matplotlib.pyplot</span> <span class="kn">as</span> <span class="nn">plt</span>
<span class="kn">import</span> <span class="nn">asciitable</span>
<span class="kn">import</span> <span class="nn">pyfits</span>
<span class="kn">import</span> <span class="nn">pywcs</span>
<span class="kn">import</span> <span class="nn">atpy</span>
<span class="kn">import</span> <span class="nn">aplpy</span>
<span class="k">print</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">__version__</span><span class="p">)</span>
<span class="n">x</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">linspace</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">20</span><span class="p">,</span> <span class="mi">100</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">np</span><span class="o">.</span><span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>
</pre></div>
</div>
<p>Hopefully you are done and have a CIAO Python that you can use for all your analysis!</p>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper"><h3>Page Contents</h3>
<ul>
<li><a class="reference internal" href="#">Python information for CfA</a><ul>
<li><a class="reference internal" href="#using-python-the-head-network">Using Python the HEAD network</a></li>
<li><a class="reference internal" href="#using-python-on-the-cf-network">Using Python on the CF network</a></li>
<li><a class="reference internal" href="#scipy-matplotlib-and-the-rest-in-ciao-on-head">SciPy, matplotlib (and the rest) in CIAO on HEAD</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="local.html"
title="previous chapter">Local information</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="../astropy/data/README.html"
title="next chapter">gll_psc_v08.fit</a></p>
</div>
</div>
<div class="clearer"></div>
</div>
<footer class="footer">
<p class="pull-right">
<a href="../_sources/local/cfa.txt"
rel="nofollow">Page Source</a>
<a href="#">Back to Top</a></p>
<p>
© Copyright 2011-2015, Smithsonian Astrophysical Observatory under
terms of <a rel="license"
href="http://creativecommons.org/licenses/by/3.0/">CC
Attribution 3.0</a>.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.3.1.
</footer>
</body>
</html>