File: README

package info (click to toggle)
python-cpl 0.3.6-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 500 kB
  • sloc: python: 2,448; ansic: 1,334; sh: 357; makefile: 48
file content (137 lines) | stat: -rw-r--r-- 4,198 bytes parent folder | download
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
This subdir contains an non-official library to access CPL modules via
Python. It is not meant as part of the MUSE pipeline software, but may be
useful for testing.

Installation
============

1. Check requirements:
   - CPL 5.X (Esorex is not needed)
   - Python 2.6 
   - pyfits

2. Determine where to put the compiled python package. Standard for
   compilations is /usr/local.

3. In this directory, run 

   python setup.py install --prefix=<PREFIX>

   where the prefix determines the path for the compiled package. The package 
   will be installed in the subdir lib/python2.6/site-packages 
   (lib64/python2.6/site-packages on 64 bit systems) of <PREFIX>

4. Add the directory <PREFIX>/lib[64]/python2.6/site-packages to your 
   environment variable PYTHONPATH.

Short tutorial
==============

Input lines are indicated with ">>>" (the python prompt).
The package can be imported with

>>> import cpl

This import statement will fail if the CPL libraries are not found.  
Init the search path for CPL recipes from the esorex startup and list
available recipes:

>>> cpl.esorex.init()
>>> cpl.Recipe.list()
['muse_bias', 'muse_dark', 'muse_flat', 'muse_focus', 'muse_wavecal', 
 'muse_scibasic', 'muse_scipost', 'muse_sky', 'muse_quick_image']

To create a recipe specified by name:

>>> muse_scibasic = cpl.Recipe('muse_scibasic')

List all parameters:

>>> muse_scibasic.param
[Parameter('nifu', default=99), Parameter('cr', default=none), 
 Parameter('xbox', default=15), Parameter('ybox', default=40), 
 Parameter('passes', default=2), Parameter('thres', default=4.5), 
 Parameter('resample', default=False), Parameter('dlambda', default=1.25)]

Set a parameter:

>>> muse_scibasic.param.nifu = 1

Print the value of a parameter (shows "None" if the parameter is set to default)

>>> print muse_scibasic.param.nifu.value
1

List all calibration frames:

>>> muse_scibasic.calib
[FrameDef('TRACE_TABLE', value=None), FrameDef('WAVECAL_TABLE', value=None), 
 FrameDef('MASTER_BIAS', value=None), FrameDef('MASTER_DARK', value=None), 
 FrameDef('GEOMETRY_TABLE', value=None), FrameDef('BADPIX_TABLE', value=None), 
 FrameDef('MASTER_FLAT', value=None)]

Set calibration frames with files:

>>> muse_scibasic.calib.MASTER_BIAS    = 'MASTER_BIAS-01.fits'
>>> muse_scibasic.calib.MASTER_FLAT    = 'MASTER_FLAT-01.fits'
>>> muse_scibasic.calib.TRACE_TABLE    = 'TRACE_TABLE-01.fits'
>>> muse_scibasic.calib.GEOMETRY_TABLE = 'geometry_table.fits'

Set calibration frame with Pyfits HDUList:

>>> import pyfits
>>> wavecal = pyfits.open('WAVECAL_TABLE-01_flat.fits')
>>> muse_scibasic.calib.WAVECAL_TABLE = wavecal

To set more than one file for a tag, put the files and/or HDULists into a
list.

Run the recipe with the default (first) raw data tag:

>>> res = muse_scibasic('Scene_fusion_1.fits')

Run the recipe with a nondefault tag (use raw data tag as argument name):

>>> res = muse_scibasic(SKY = 'sky_newmoon_no_noise_1.fits')

Run the recipe with alternative parameter or calibration tag setting (use
parameter names or calibration tags as argument names)

>>> res =  muse_scibasic('Scene_fusion_1.fits', nifu = 2, MASTER_FLAT = None,
...                      WAVECAL_TABLE = 'WAVECAL_TABLE_noflat.fits')

The results of a calibration run are pyfits HDUList objects.  To save them
(use output tags as attributes):

>>> res.PIXTABLE_OBJECT.writeto('Scene_fusion_pixtable.fits')

They can also be used directly as input of other recipes. 

>>> muse_sky = cpl.Recipe('muse_sky')
...
>>> res_sky = muse_sky(res.PIXTABLE_OBJECT)

If not saved, the output is usually lost! During recipe run, a temporary
directory is created where the HDUList input objects and the output files are
put into. This directory is cleaned up afterwards.

On default, the temporary directory is put into the current directory. to
change its location:

>>> muse_scibasic.temp_dir = '/tmp'

You can also make the output directly permanent. For this, specify an output
directory:

>>> muse_scibasic.output_dir = '/work1/durham/Data/scibasic'

To control message verbosity on terminal (use 'debug', 'info', 'warn', 'error'
or 'off'):

>>> cpl.msg.level = 'debug'

Feedback
========

Send to python-cpl@liska.ath.cx