EMIR OSP Facility Tool
We have developed a tool that permits the quick checking of the files generated by the OSP, to detect any problem, and that also produces a summary file that may be of some use for monitoring the observation. The tool can be downloaded here: OSP2CSUv9.py. For this to work, the code has to installed in the same directory as the OSP. Below is an example of its use:
First trial:
python3 OSP2CSUv9.py
This script takes 2 arguments: XML and CSU input files
If just 1 is given then files are <name>.xml & <name>.csu
Option: a second or third argument beginning with + or -
specifying the nodding throw in arcsecs
Now, with the file names and the nodding throw:
python3 OSP2CSUv9.py ../emir/mos_sciver/ext/test_mask2 -5.0
18h07m31.8135s -20d17m08.0981s 113.63966541766129
UUID: 7fc00901-edcf-4d0a-94ab-aa2757e1144c
Object: 18:07:23.345 -20:19:45.08 slit: 2
Coord. estandar: 191.584 -46.167
VirPix X Y: 787.140 39.506
....
and the full list of object in the mask. Then, two new files should be in the same folder than the XML and CSU files:
- test_mask2.summary
- test_mask2.png

The PNG file shows how the mask will be seen by the EMIR detector. The target objects are plotted as blue crosses and the reference objects, as red ones. The red arrow, if present, at the middle left shows the direction in which the objects will move from A to B in the telescope nodding ABBA sequence. Be aware that it shows the motion of the objects, not that of the telescope, in the EMIR focal plane when nodding. In the title and subtitle, the mask name and mask id are printed. Users must inspect this figure carefully looking for flaws. For instance, in the above figure some of the objects will be lost when the telescope nods to the second pointing, and the objects will move in the detector following the arrow, as the nod throw is 7.2 arcsecs, or one full slit height.
New from version 7, the script will add to each object in the PNG figure a solid circle in magenta that shows the position of the object in the mask, but now plotted from the pixel position in the CSU file (columns 4 to7). These positions are calculated in the OSP and used by the MOS Image Acquisition mode in EMIR to locate the mask in the exact desired position by repointing the telescope. It is known that in some rare cases the OSP output wrong pixel coordinates. While these coordinates have no influence at all in the observations, they are essential in the reference stars to adjust the position of the mask on the sky. In the above figure, we see that the reference star in slit 46 has no magenta circle, indicating a severe problem for this object. If that happens, the user has two options to solve this:
- repeat the mask from scratch as this error is most likely cause by a memory leakage at the OSP runtime. This option is strongly favoured.
- manually edit the CSU file and change the slit flag (3rd column) from 2 to 1. By so doing, these object will be no longer a reference star so it will not confuse the acquisition mode. Remember to do this in the two bars that form the slit (46 and 101 in this case) and in all the joined slits to the first one.
Also new from version 8 onward, the script will output at the end of the object list, the X central coordinate of each slit in the mask calculated from the bar positions in the CSU file, as for the slits in the figure, and the object coordinate in the same CSU file, calculated in the OSP. If there is no object associated to the slit, this second coordinate is set to the mask centre, 1024.5. This output looks as follows:
…
Slit: 22 VirPixX CSU OSP: 840.10 840.10
Slit: 23 VirPixX CSU OSP: 839.83 1024.50 *****
Slit: 24 VirPixX CSU OSP: 1429.60 1429.60
…
Slit: 45 VirPixX CSU OSP: 761.33 761.33
Slit: 46 VirPixX CSU OSP: 597.28 761.33 *****
Slit: 47 VirPixX CSU OSP: 706.23 706.23
…
In the above list, slits 23 and 46 can be easily identifed as problematic by the asterisks at the end. While slit 23 is not a reference one, so it can be skipped, slit 46 is a reference and has to be fixed before going ahead. A close inspection of the CSU file, listed below, will show that slit 23 is not properly joined to slit 22, as it should be, because the bar positions are correct but the object coordinates are -100, as it would be no object associated to the slit. The slit 46 is correctly positioned far from slit 45 but the object coordinates are incorrectly the same, probably due to the change in the slit position while editing the mask.
…
022 138.566 1 840.102 811.378 839.910 811.157
077 201.153 1 840.102 811.378 839.910 811.157
023 138.733 0 -100.000 -100.000 -100.000 -100.000
078 201.285 0 -100.000 -100.000 -100.000 -100.000
…
045 125.866 1 761.327 1641.781 759.716 1645.559
100 214.298 1 761.327 1641.781 759.716 1645.559
046 098.638 2 761.327 1641.781 759.716 1645.559
101 241.293 2 761.327 1641.781 759.716 1645.559
…
To summarise the above discussion, a mask can be considered correct and safe to be sent to GTC phase 2 if and only if:
- the figure displays as in the OSP.
- all the crosses, blue and red, match with the slits
- at least all the red crosses match with the magenta circles, so in the script oputput none of the reference slits have asterisks.
The summary file contains useful info about the mask. The first lines in the example above display as:
Mask name: test_mask.csu
Mask-id: 04405bd0-b41b-43d6-9fac-3a14cf8f7910
********** Summary **********
Pointing coordinates: 10h00m23.839s +02d14m06.43s
Mask position angle [deg]: -113.766
EMIR IPA [deg]: 66.289
No. of assigned objects: 31
No. of open/assigned slits: 53
No. of reference slits: 4
No. of single slits: 9
No. of joined slits: 22
Double 22
Triple 0
Quadruple 0
>4 0
Slits: 2 - 3 width: 0.8 arcsec
Assigned object: 6207
10h00m18.69s +02d16m52.16s
2.1447001 / 21.712212
Slits: 4 - 5 width: 0.8 arcsec ****Ref. Object****
Assigned object: 1635721458409799680
10h00m16.12s +02d16m23.08s
12.345 / 11.938 / 11.864
....