Skip to content
Guillermo Giménez de Castro edited this page Jul 22, 2025 · 12 revisions

HATSpy: User and Developer Manual -- V0.01

Guigue (a.k.a. Guillermo Giménez de Castro)


Copyright © 2025 by Guigue All rights reserved.


Introduction

HATSpy is a set of programs written in python and C used to reduce and analyze data from HATS telescope. It is an ipython profile as well to ease the use of the software. This manual was written and tested in Linux Debian version 11 with kernel 5.10.0-35-amd64 python 3.9 and ipython 7.20 and with Ubuntu 20.04.6, kernel 5.4.0-216-generic, python 3.8.10 and ipython 7.13.

Installation

HATSpy is developed in python 3.7 or later and standard C. The most updated version of the software can be downloaded from https://github.com/guigue/CRAAM-Instruments/HATS. The software can be installed in any directory, and environment variables must be defined.

  1. PYTHONPATH: must include the path where the python code is installed.
  2. HATSXMLPATH: must point to the directory where .xml HATS files are copied.
  3. HATS_DATA_InputPath: Directory where data is downloaded. We will talk about the structure of this directory later.
  4. HATS_WS_InputPath: weather station data directory.
  5. HATS_FFTProgram: full path to the binary code of the FFT program.

hatspy profile

To create this profile you run the command ipython profile create hats. The go to the directory $HOME/ipython/profile_hats/startup and create the file 00-hats.py with the following lines

              import HATS 
              from HATSTools import *
              import numpy as np
              from matplotlib.pyplot import plot
              from matplotlib import pyplot as plt
              from astropy import units as u
              from astropy import constants as c
              from astropy.time import Time
              plt.ion() 

Finally, create an alias:

(BASH) > alias hatspy='ipython3 --pylab --profile=hats'

(CSH) > alias hatspy 'ipython3 --pylab --profile=hats'

You can (have to) add one of the previous lines in $HOME/.bashrc or $HOME/.cshrc files. Next shell you open, you should be able to run

> hatspy
Python 3.8.10 (default, Mar 18 2025, 20:04:55) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.13.0 -- An enhanced Interactive Python. Type '?' for help.

IPython profile: hats
Using matplotlib backend: TkAgg

HOMS Configuration

The HATS Operation, Monitoring and Storage (HOMS) computer at the OAFA observatory is configured as follows:

                        PYTHONPATH=/opt/HAX/python
                        HATSXMLPATH=/opt/HAX/python/XMLTables
                        HATS_DATA_InputPath=/homs/HATS/data
                        HATS_WS_InputPath=/homs/HATS/data/aux
                        HATS_FFTProgram=/opt/HAX/python/HATS_fft

HATS Data Model

HATS data is distributed between binary and ascii files. Astronomical data, or just data, is stored in .rbd binary files (for Raw Binary Data), auxiliary data is stored in .aux binary files. Auxiliary files are stored in a subdirectory of the main data directory, also the weather station data is stored in the AUX subdirectory. The log files are stored in another subdirectory at the same data directory level. Graphically:

       root
         |
         |__data
         |    | 
         |    |__ aux 
         |
         |__log 

The data model is described in .xml files located in the HATSXMLPATH directory defined during the installation process in an environment variable (see above). .rbd are defined in HATSDataFormat.xml while .aux files in HATSAuxFormat.xml. Filename format is defined in the acquisition software (HOMS_data_transfer_daemon.c). The name is as follows

  RBD files: hats-YYYY-MM-DDTHH00.rbd
  AUX files: hats-YYYY-MM-DDTHH00.aux

where YYYY-MM-DDTHH00 is the observation time in ISO format (see that minutes are set to 00, even if the observation starts after 0 minutes). Every hour a new pair of RBD/AUX files is created.

RBD are fixed-length binary files time-stamped 1-millisecond Golay and temperature sensors readouts in ADC units (integer numbers from $1$ to $10^{24}-1$), and the time-stamp in husec (100 µs) since 0 UT of the day among other data. AUX files are time-stamped, fixed-length binary 1-second files with right ascension, declination, azimuth, and elevation read from the telescope mount; flags and special codes for the operation modes.

Weather Station

The weather station data is stored in the AUX directory with the name hats-YYYY-MM-DD.ws. They are ascii files with time-stamped records. hatspy has a special routine to read these data files.

Clone this wiki locally