PI cataloging procedure



1. Photometry

a/ fast photometry

b/ asas photometry on 20 averaged frames

20 images are sumed and averaged, in case change of coordinates is detected , greater then 0.1 deg = 360 arc sec = 6 arcmin = 6 pixels , then
sumation is stoped and new sum is started.

NOTE:
Fast photometry makes horizontal flip (in spite of ASAS-PIPELINE ...) - so x,y in mag/ast/catalog is in fact 2062-x,y on image

2. Astrometry

Astrometry procedure ws addopted from ASAS experiment and will not be described here in details
NOTE:
ASAS-PIPELINE makes VERTICAL flip of frame for photometry/astrometry - see red_frame program by Dorota & Bogumil.
So y=2048-y in fact and also border 8,8,8,24 is cut of !!!

Asas astrometry needs good specification of starting parameters  especially  rotation  angle ( option -fi ) ,  ra ( -ra ) , dec ( -dec ).
It is enough to specify -fi with precision about 2 degrees , otherwise astrometry will probably fail.
Some problems were detected when running astrometry on near pole images ... - still must be resolved ...

3. Cataloging

Pi cataloging procedure is based on Postgres database. The starting poing are so called ast files which are basically lists of stars with the following
information :

          RA DEC x y   MAG mag0 mag1 mag2 ...magN

This files are produced in the following steps :

The next step which will be described in this section is to put ast files information to database and normalize stars magnitudo according to star catalog.
This process has several steps , first step is performed by piaddast2 program  ( refered later as piaddast2 step ) :
   
  1.     IMPORTANT : Drop indexes on table Measurements ( and some on Stars ) before loading
  2.     frame information from header of ast file ( same like in fits header ) is added to database tables frame and frame_det ( table ObsFieldStat is
        automatically updated )
  3. Stars from ast file are read to memory
  4. Stars in the observed field are read from database table Stars to memory ( if not already read for ealier image of same field ), only
    stars with number of observations >=2 are read ( or >=1 for scan )
  5. Normalization of magnitudo of stars read from ast file is done :
  6. ast-stars are matched to db-stars ( read from DB)  and measurements from ast are added to memory-table measurements_tab for
    every star, in case ast-star is not found in db-stars list it is added as new and field new_star in measurements table is filled with true value
    ( false otherwise ). Star measurements is matched to existing star in case it is closer then matching radius ( currently set to 120 arcsec ),
    otherwise new star record is created.
  7. After ast from other field comes all stars/measurements tables stored in memory are dumped to sql file and it is loaded to database.
    Stars from database are read to memory according to ra,dec coordinates of the observed field and every new ast file is handled
    as desribed in points 1-5, unitil new field aperas or no more ast files are found
  8. when loading stars to database measurements are checked, in case one star has more then one measurements on single frame then
    both are rejected, this seems to be main source of the problem of "bad measurements" - single points far from light curve .
    Maybe it will be changed so that only "wors  measurement" will be rejected and better will be kept, but this is not obvious how to
    guess which one is good , so now I reject both.
    This problem should not exist if photometry is good enough and does not identify same star as 2 or more different object, but
    asas photometry program is not resistant for such problems and sometimes single big star produces 2 objects to be cataloged.
    One have good magnitudo and second has much different ! Option in cataloging program piaddast2 -skip_dups enabled rejection and
    is enabled by default
After ast files data is loaded it is nessesary to perform some addeditional actions , which are :

  1. Creation of indexes in database for faster queries
  2. recalculation of values of several fields  in Star table like : magnitude (  average magnitudo ) , sigma_mag ( rms of the magnitude
    no_measurements ( number of measurements for this star ), this can be done during piaddast2 step but when loading lots of data
    from many nights it is better to do it afterwards
  3. NEW : Stars from both cameras are matched together by field cam2_sstar_id - matching radius is currently 2 arcmin ( 120 arcsec ) - which is
    same value as in star matching in cataloging procedure, however for old database ( created ealier then 2006-01-11 ) it was 5 arcmin
    which is too much and can cause problem - that in case there is close star but not good it can overwrite good setting, my notes on this problem ( in polish ) :
                    jakis blad w linkowaniu gwiazd 20040918_asas@heplx48 :
                   gwiazda 30365 ma link 84146 a tak naprawde powinna miec : 84155
                  i o co chodzi ????
                 juz chyba mam podejrzenie !!!
                 Moze chodzi ze ta 84146 jest pozniej ale tez jest < 5 arcmin od tej
                 i stad nadpisuje juz dobre ustawienie !
                5 arcmin to za duzo - zmieniam na 120 arcsec = 2 arcmin
               Tak czyli 5 arcmin = 300 arcsec to za duzo !
  4. Optimize database , by creating cluster on tables Stars/Measurements , so that measurements of particular star are physicaly placed
    in the same place on the disk
  5. fill SuperStar table and set sstar_id field on Stars table
Here are list new options and fixes which possibly should be applied ( loading should be repeated ... ) :
  1. links between camers - matching radius changed to 2 arcmin ( 20060111 )
  2. skiping measurements in case >1 measurement of single star on single frame found ( 20051220 )
  3. bugfix ( 20051220 )  : measurements from k2b could be wrongly linked to stars from camera k2a , check :
           select spathtofile,icamid from frame,measurements where
                    frame.id_frm=measurements.id_frm and star=1;
  4. -min_star_count=15000 - option to specify minimal number of stars in ast file to be catalogued, otherwise
    number of stars is not enough to have good normalization to star catalog and measurements cause artificial flares, brigthness increase etc ...
  5. 20060208 : Currently testing with min_stars_to_add_new=1 - to have measurements also of single measurements object - for moving objects finding

Problems to be resolved ( more details here ):
      To chyba juz jasne chodzi generalnie o klatki przy-biegunowe ,
      mianowicie problem jest w funkcji BinaryFindStar znajduje sie
      gwiazda po start_ra i end_ra, ale one sa universalne
      dla wszystkich klatek tymczasem dla przybiegunowych moze byc
      tak ze to jednak nie wystarcza bo w skryjnej sytuacji moze
      byc ze ra1=0.000001 a ra2=23.999999 i to jest ta sama gwiazda
      a moj search jej nie znajdzie !!!
      Trzeba rozwazyc takie cos ze klatki przybiegunowe nalezy katalogowac
      troszke wolniej - tzn moze nie binary searchem tylko
      liniowym i CalcDistInDeg sprawdzac , a moze miec to sortowane po dec
      a nie ra - hmm to moze byloby dobre rozwiazanie , z tym ze nie pamietam
      czemu jest po ra .... hmm to chyba nie byla dobra decyzja ...
       Przez ten bug, mimo pozornie duze odleglosci w samym ra to
        CalcDistInDeg jest tak naprawde bardzo maly i gwiazda sie nie znajduje
       a moglaby spokojnie sie znalezc !!!
                                                                               
      Gdyby to zmienic na sort-a po dec to jednak byloby poprawnie !
      Bo dec jest ok , nie ma "osobliwosci" na biegunie
                                                                               
     1/ krok zrobic - dobry opis procedury katalogowania - bardzo dokladny
        moze z diagramem - takmi jak zaczalem robic dla genscript
     2/ przejrzec kod i na probe moze go zmienic , skatalogowac noc nowym i
        zobaczyc czy wszystko jest OK
     3/ pomyslec jakie byly argumenty za wyborem sorta po ra ???
     4/ potem test na tych polach ze scanu czy sie poprawia ?

4. On-line cataloging

It is possible to run cataloging of coming frames in on-line mode ( both single-fast-photmetry and averaged-pi-pipeline ), program pi_red_frame is used for averaging and reduction
in of averaged frames shift by 0.1 degree ( controlled by paramter -max_coord_change ) causes end of current average and start of new one. It is required for 20 averaged frames at least 10
singles for averaged frame to be cataloged to database ( less can cause larger measurements errors )

 5. Most important scripts/programs for cataloging

Full list of scripts and programs for cataloging is listed in this table , most important scripts and programs are in red-bold font.
Most important scripts for cataloging are the following :

  1. run_asas_pipeline_online_cat! - script for on-line pi-reduction , asas-photometry, asas-astrometry and pi-cataloging to database of frames averaged
    default number of averaged frames is 20, but this can be changed, example of usage can be found on heplx48 :
             [pi@heplx48 new_version]$ pwd
             /opt/pi/dev/pisys/daq/ndir/data/photo/new_version
             #!/bin/bash 
             nohup run_asas_pipeline_online_cat! 20050301 /scratch/pi_fits2004/results/fits/ /opt/pi/dev/pisys/daq/ndir/data/photo/new_version 20050301_new > out 2>&1 &
  2. run_single_scan_cat! - script for pi-reduction, fast-photometry, asas-astrometry and pi-cataloging of scan single frames , example :
             cd /pi20/msok/scan
             #!/bin/bash 
             nohup run_single_scan_cat! 20050103/ /pi20/msok/scan/20050103/ /pi20/msok/scan/SCAN_PIPELINE/ scan_single > out 2>&1 &
  3. run_scan_cat! - script for pi-reduction, asas-photometry, asas-astrometry and pi-cataloging of scan averaged frames
  4. run_fast_pipeline_online_cat! - script for on-line fast-photometry/reduction , asas-astrometry and pi-cataloging to database of single frames, usage example ( tested ) :
              #!/bin/bash
              nohup run_fast_pipeline_online_cat! 20040928 /pi20/msok/fast/ONLINE/SMALL/fits/ /pi20/msok/fast/ONLINE/SMALL/ 20040928_fast > out 2>&1 &

6. Times and disks space of cataloging steps :

a/ fast photometry :

STEP
DESCRIPTION
# FRAMES
TOTAL TIME [sec]
TIME PER FRAME [sec]
DISK
SPACE
fast-photometry
through gigabit ethernet and nfs, tested in :
heplx49:/opt/pi/dev/pisys/daq/ndir/data/fast/20050506_fast/20050506
2789
k2a : 5400

k2a : 1.93
20040929-
20041231
 = 292GB
-> ~5 GB / night
asas-astrometry
asas-astrometry ( already local )
2789 k2a+k2b = 27 h
k2a : 9h 4 min
k2b : 15h 35 min
czyli k2b duzo gorzej wiec mozna
zakladac ze to bedzie kolo ~2*9h =18h


pi-cataloging
cataloging of fast photometry

trudno w tym tescie ocenic bo robilo sie rownolegle z
astrometria - nowe asty byly dodawane do bazy
czyli dla k2a<=9h
Na kompie z dual-core ( heplx48 )




b/ pi-pipeline online ( 20 averaged frames )


c/ scan cataloging

d/ single scan cataloging
STEP DESCRIPTION # FRAMES TOTAL TIME [sec] TIME PER FRAME [sec] DISK SPACE
fast-photometry

62
k2a : 2 min


asas-astrometry

62
k2a : 9h - ale timeout byl +INFINITY i
jak sie nie udalo to robil retry z mniejszymi wymaganiami na
blad astrometri - ale moze jednak trzeba to zmienic i
po prostu jak sie nie robi to trudno


cataloging

62
k2a : 1h

212 nights : ~30GB
( ~150 MB / night )


7. Current settings


8. New changes

New change is that instead of calculating coordinates ranges , it is checked in astfile by finding ra_min,ra_max,dec_min,dec_max this makes
selection more strict and db query faster - currently being tested in WAW
Testy wypadly pomyslnie ,
UWAGI : przy ladowaniu dwa razy tych samych klatek liczba gwiazd nie drgnela - czyli bylo tyle samo co po pierwszym ladowaniu , to jest ok
zauwazylem natomiast ze liczba pomiarow nie zwiekszyla sie dwukrotnie, okazuje sie ze jest tak dlatego ze opacja -skip_dups jest defaultem.
Czyli jak na klatce gwiazda ma >1 pomiar to oba sa skipowane, mysle czy tego jednak nie zmienic, mozna np wybrac ten ktory jest blizej
srodka katalogowanej gwiazdy i ten wlozyc do bazy a drugi zignorowac, ale musze to jeszcze przemyslec na razie nic nie zmieniam
Poza tym wyglada na to ze jest ok, teraz sie okaze czy da nam to jakies znaczace przyspieszenia selekcji ( bo teraz beda 2 indexy uzywane )
Motivation for this change is described here.