EMIR Optimized Slits Positioner ( OSP) is an aplication written in java, using the JSkyCat library and implementing algorithms to search and validate optimized project masks. The Multi-Object Spectroscopic (MOS) system of EMIR is composed of a robotic reconfigurable multi-slit mask or Cold Slit Unit ( CSU). It can be able to obtain 55 spectra simultaneously and this tool is needed to optimize the science targets in our field, simulate the final characteristics of the 2D spectra on the detector, and allow the user to perform the configuration of all the slits though a Graphical User Interface.

Download and Install

The EMIR OSP can de downloaded here.

To install unpack the tar.gz file using (for example) the command:

     $ tar -zxvf EMIR-OSP-v<version>.tar.gz

To run the OSP simply use the commands:

     $ cd OSP-v<version>/
     $ ./osp.sh

Please make sure that the osp.sh file is executable to run the final command (by default it should be).


The EMIR-OSP-cookbook is a guide on how to use the OSP and contains some helpful tips and tricks. Please note that the EMIR OSP documentation is currently being improved.

EMIR OSP overview and Usage

Briefly, the OSP takes as input an image of the region of interest as well as a catalogue, either user defined or using one of the available catalogue tools, and allows the user to allocate slitlets to targets in an optimised way. The result is then taken as input for the GTC to create the appropriate masks at the telescope.

To use the EMIR OSP one must have two input files:

  1. A user input catalogue
  2. An image covering the field of view

A template input catalogue can be found here. The input image must be in the correct orientation (North up, East left) and contain no distortions.


The output is an XML file describing the complete shape of the mask. Individual slits are specified by their central position on the field, their length, and their width. These values have to be specified for each slit, together with the position of the center and the orientation of the field. The OSP will be mainly used during the preparation phases of an observation (Phase II of GTC).

To send comments or bug detection please, do not hesitate to send an email to: lpatrick [at] iac.es and osp-support(at)ast(dot)obs-mip(dot)fr


New features in the OSP

Starting from version 2.6.6, the OSP has incorporated interesting features that are commented on briefly here.

The user may select to not add any info other than object coordinates in the  input catalogue to the OSP. Then, these keywords will remain empty, but will still be in the fits header. It is also optional to supply the <file_name>.conf file to the EMIR control system but if this is not supplied, the new keywords will be empty, as before.

It is particularly important to supply at least an ObjID for the objects used as a reference in joined slits. This is because joining two or more slits for a reference object results in an additional margin of error to locate the reference object in case of bad initial pointing (which should not happen). In addition, it may also result in a uncertainties in the fine centring of the mask if an unwanted object is also present in the joined slits. Remember that EMIR operates in a 10m class telescope. In those cases, the acquisition software will consider the joined slits as a single area for searching only if all the OBJSLNN keywords contain the same string, which will be the case if the object used as reference has an identifier in the input catalogue.

Facility tool to check the OSP result

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: OSP2CSUv6.py (new version since March 17). 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 OSP2CSUv6.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 OSP2CSUv6.py ../emir/mos_sciver/ext/test_mask +7.2
10h00m23.839s 2d14m06.4278s -113.76646054108379
UUID:  04405bd0-b41b-43d6-9fac-3a14cf8f7910
        Object: 10:00:18.688 +02:16:52.16
                Coord. estandar:   182.792    3.865
                 1044.370   84.707

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:

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.

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