Adding info to Headers

If you want to add an information to the header using scripts or ocs console follow the steps.

1. In your script add:

response_X = ocs('set', 'X '+str(value of X));print 'X set',response_X

if response_X!='SUCCESS':

print response_X;sys.exit()

or in console type set X value of x

2. Edit the OCS.pml.py code in the ~/dr/OCS-legacy/python/OCS/ directory

introduce

self.default_x = choose a default value for x

where all other values for default are introduced

3. under def set(self,params): add to the list

if key == 'X':

self.default_X = float(value of x)

return 'SUCCESS'

where you choose what type of data you want to put into the header ( float(value of x), str(value of x),int(value of x) )

4. add

OCS.exposure.X = OCS.default_X

under other lines of this form

5.Now edit IB.py in ~/dr/IB-trunk/python/IB/

hdu.header.update('X',exposure.X,'comment comment')

or

primary.header.update('X',exposure.X,'comment comment')

under the long list of

hdu.header.update()

or

primary.header.update()

6. Restart SISPI

7. In case object exposition.X gives an error saying object expose.X cannot be subscribed you can,

a) redo Step 4 and 5 changing OCS.exposure.X to OCS.exposure.Y and hdu.header.update('X',exposure.X,'comment comment') to hdu.header.update('X',exposure.Y,'comment comment') where Y is recognized by exposure

b) edit exposure.py in SISPIlib, by adding and object X to the list:

properties = {

'file_uri' : 'string',

'thumbnail' : 'string',

'errors' : 'string',

'X' : 'type of X'

HINT

If you cannot find the place in the code you should add a line, use find: the same line with ra or dec instead of X

HINT 2

If you want to hardcode a fixed value (one that is not expected to change for a foreseeable future) just do step 4