Gaia@home

Code example in Python for Gaia@home

The second, more practical example is the script that uses data from Gaia Archive query results, searching for objects at Pleiades Cluster coordinates. Then the script filters the received data and computes the mean values and standard deviation for proper motion of a found objects. This example has two input files the Gaia query results and config file with defined proper motion. The results are saved to the output file. For input and output file use defined symbolic names.

#PLEIADES - BOINC version

#Searching the Pleiades and computing the mean value and standard deviation of proper motion

import numpy as np

#loading gaia results (using numpy to read whole table)
#use defined symbolic name as file names when opening the files
r=np.loadtxt(fname="Symbolic_gaia_data", skiprows=1)


#constants are defined in an input config file
with open("Symbolic_config") as f:
    line = f.readlines()[0].split(' ')
    pmra0=float(line[0])
    pmdec0=float(line[1])

#filtering the output from Gaia archive for objects with (pmra-pmra0)**2+(pmdec-pmdec0**2) < 5**2
#and saving results to numpy arrays
pm_ra=np.array([])
pm_dec=np.array([])
for row in r:
    if (row[0]-pmra0)**2+(row[1]-pmdec0)**2 < 25.0:
        pm_ra=np.append(pm_ra,row[0])
        pm_dec=np.append(pm_dec,row[1])

#computing mean values and standard deviation using numpy
mean_pmra=np.mean(pm_ra)
mean_pmdec=np.mean(pm_dec)
stdev_pmra=np.std(pm_ra)
stdev_pmdec=np.std(pm_dec)

#saving results to output file
with open("Symbolic_result",'a') as f:
    f.write(f'{mean_pmra},{mean_pmdec}\n{stdev_pmra},{stdev_pmdec}\n')

Compilations should be performed on the target system on which the program is to run and run the appropriate compilers:

  • Windows py2win
  • MacOS   py2app
  • Unix        pyinstaller

The libraries used for compilation must be compatible with the BOINC system :  GLIBC 2.28-10

You can check the version of the libraries by issuing a command in bash shell: ldd --version | head -n1 | cut -d" " -f2-

If you have newer versions of the libraries contact us for correct compilation.

You can find the correctly compiled code for the example here : Gaia@home_application

We are ready to launch task in Gaia@home service

Article Details