# Basics

iSpec provides a visual interface from where the user can interact with the spectra and use different useful functionalities. Nevertheless, there are options and functionalities that can only be accessed via Python.

The visual interface is convenient to learn the fundamental aspects of iSpec, to test the result of certain operations and for educational purposes. Once the user is familiarized with iSpec, it is recommended to work mainly with Python scripts. Scripting give access to all the functionalities and ensures reproducibility, which is a very important feature for science.

In this section ('Usage' section), we will learn how to use the visual interface and some fundamental aspects of iSpec.

## Execution

The visual interface can be launched by double clicking "iSpec.command" or executing in a terminal located in iSpec's directory:

./iSpec.command

## Opening spectra

iSpec can open multiple spectra files simultaneously through the menu "File - Open spectra". At every moment, only one spectrum is active and its marked with a "[A]" symbol in the legend box.

Operations such as radial velocity determination are executed only on the active spectrum. To change the active spectra, the user has to select a different one through the menu "Spectra - Name of the spectrum" or directly closing the active one through "Spectra - Close spectrum". In case the spectrum has been modified and not saved, iSpec will ask for confirmation before closing it.

The flux errors can be plotted by activating "Spectra - Show errors in plot". This will plot two discontinuous lines above and below the spectrum representing the flux +/- the errors.

iSpec can also be executed from command line indicating directly the spectra to be opened:

./iSpec.command input/spectra/examples/NARVAL_Sun_Vesta-1.txt.gz

### Spectra file formats

iSpec can read certain FITS files:

• 1-D FITS file with CDELT/CRVAL values in the header and fluxes in the primary extension
• FITS files containing a table in the primary extension where columns are wavelength, fluxes and, optionally, errors

In both cases, Angstrom is assumed as unit and transformed to nanometers internally, unless the CUNIT value is set on the header indicating otherwise.

iSpec can also read plain text files with tab character as column delimiter. Three columns should exists: wavelength, flux and error (although in case the error is unknown, it can be set all to zero). The first line should contain the header names 'waveobs', 'flux' and 'err' such as in the following example:

waveobs       flux          err
370.000000000 1.26095742505 1.53596736433
370.001897436 1.22468868618 1.55692475754
370.003794872 1.18323884263 1.47304952231
370.005692308 1.16766911881 1.49393329036

Wavelength should be in nanometers, if it is not the case, it can still be loaded into iSpec and transformed using the "Apply mathematical operation" option (e.g. applying waveobs/10).

To save space, the FITS file and the plain text file can be compressed in gzip format and iSpec can automatically compress/decompress.

## Exploring spectra

Zoom can be activated using the "zoom mode" button. Once done, left clicking and dragging defines the zone to be augmented. The home icon reverts the zoom and the back/forward arrows permits going back to the previous zoomed region.

It is also possible to move the current visualization zone by selecting the Pan mode, left clicking and dragging the mouse. Additionally, in this mode it is possible also to zoom in/out by right clicking and dragging the mouse.

## Saving images, spectra and regions

Through the "File" menu it is possible to save a PNG image of the current plot, the active spectrum or the continuum, line and segment regions (see next section). It is worth noting that in the title of the editor's window will appear "segments", "lines", "continuum" or "name_of_spectrum" to indicate that some of these elements have been modified but not saved.

## Interoperability with other SAMP applications

iSpec is a SAMP ready application and therefore it can send/receive spectra to/from other astronomical programs (i.e. TOPCAT, VOSpec, splat) running in the same machine.

To enable the interopability option, it is necessary to run a SAMP hub in the system. The easiest way to do so is to install and run TOPCAT (it starts automatically a SAMP hub).

From the menu "Edit - Send spectrum to...", the current active spectrum can be sent to any external program connected to the SAMP hub that supports spectra or data tables.

It is also possible to send spectra from external programs to iSpec, in this case it is required that the data is structured in three columns in the following order: wavelengths, fluxes and errors. It is highly recommended to name the columns with the following labels: waveobs, flux, err.

By using this functionality, iSpec can receive data from the Virtual Observatory in a indirect way through external programs such as TOPCAT, VOSpec and splat.