IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 37422


Ignore:
Timestamp:
Sep 23, 2014, 9:53:58 AM (12 years ago)
Author:
eugene
Message:

loadstarpar basically complete, not tested

Location:
branches/eam_branches/ipp-20140904/Ohana/src/addstar
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20140904/Ohana/src/addstar/Makefile

    r37417 r37422  
    250250$(SRC)/SkyRegionUtils.$(ARCH).o \
    251251$(SRC)/args_loadstarpar.$(ARCH).o \
    252 $(SRC)/coord_transforms.$(ARCH).o \
    253252$(SRC)/find_matches_starpar.$(ARCH).o \
    254253$(SRC)/loadstarpar_catalog.$(ARCH).o \
     
    268267$(SRC)/SkyRegionUtils.$(ARCH).o \
    269268$(SRC)/args_loadstarpar.$(ARCH).o \
    270 $(SRC)/coord_transforms.$(ARCH).o \
    271269$(SRC)/find_matches_starpar.$(ARCH).o \
    272270$(SRC)/loadstarpar_catalog.$(ARCH).o \
  • branches/eam_branches/ipp-20140904/Ohana/src/addstar/include/loadstarpar.h

    r37417 r37422  
    33  double R, D;
    44  StarPar starpar;
    5   int flag; // XXX how is this used?
     5  int flag; // in a subset?
    66  int found; // assigned to an object?
    77} StarPar_Stars;
  • branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/args_loadstarpar.c

    r37417 r37422  
    2323  UserPatch.Dmin = -90;
    2424  UserPatch.Dmax = +90;
     25
     26  // XXX for the moment, make this selection manual.  it needs to be automatic
     27  // based on the state of the SkyTable
     28  HOST_ID = 0;
     29  PARALLEL = FALSE;
     30  if ((N = get_argument (argc, argv, "-parallel"))) {
     31    PARALLEL = TRUE;
     32    remove_argument (N, &argc, argv);
     33  }
     34  // this is a test mode : rather than launching the remote jobs and waiting for completion,
     35  // relphot will simply list the remote command and wait for the user to signal completion
     36  PARALLEL_MANUAL = FALSE;
     37  if ((N = get_argument (argc, argv, "-parallel-manual"))) {
     38    PARALLEL = TRUE; // -parallel-manual implies -parallel
     39    PARALLEL_MANUAL = TRUE;
     40    remove_argument (N, &argc, argv);
     41  }
     42  // this is a test mode : rather than launching the relphot_client jobs remotely, they are
     43  // run in serial via 'system'
     44  PARALLEL_SERIAL = FALSE;
     45  if ((N = get_argument (argc, argv, "-parallel-serial"))) {
     46    if (PARALLEL_MANUAL) {
     47      fprintf (stderr, "ERROR: cannot mix -parallel-manual and -parallel-serial\n");
     48      exit (1);
     49    }
     50    PARALLEL = TRUE; // -parallel-serial implies -parallel
     51    PARALLEL_SERIAL = TRUE;
     52    remove_argument (N, &argc, argv);
     53  }
    2554
    2655  /* only add to existing regions */
  • branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/coord_transforms.c

    r37417 r37422  
    11# include "addstar.h"
    22# include "loadstarpar.h"
     3
     4// values used by libdvo/coord_systems (from Liu et al 2011, A&A 526, A16):
     5// Liu etal and Reid etal disagree at the 0.3 arcsec level
     6// transform->phi =  62.8717488056*RAD_DEG;
     7// transform->Xo  =  32.9319185700*RAD_DEG;
     8// transform->xo  = 282.8594812080;
    39
    410int galactic_to_celestial (double *R, double *D, double l, double b) {
     
    713  abort();
    814}
     15
     16int celestial_to_galactic (double *l, double *b, double R, double D) {
     17
     18_angp = np.radians(192.859508333) #  12h 51m 26.282s (J2000)
     19_dngp = np.radians(27.128336111)  # +27d 07' 42.01" (J2000)
     20_l0   = np.radians(32.932)
     21_ce   = np.cos(_dngp)
     22_se   = np.sin(_dngp)
     23
     24
     25
     26}
     27
     28
     29
     30
     31/*** python version from LSD (Mario Juric)
     32
     33# Appendix of Reid et al. (http://adsabs.harvard.edu/cgi-bin/bib_query?2004ApJ...616..872R)
     34# This convention is also used by LAMBDA/WMAP (http://lambda.gsfc.nasa.gov/toolbox/tb_coordconv.cfm)
     35_angp = np.radians(192.859508333) #  12h 51m 26.282s (J2000)
     36_dngp = np.radians(27.128336111)  # +27d 07' 42.01" (J2000)
     37_l0   = np.radians(32.932)
     38_ce   = np.cos(_dngp)
     39_se   = np.sin(_dngp)
     40
     41def equgal(ra, dec):
     42        ra = np.radians(ra)
     43        dec = np.radians(dec)
     44
     45        cd, sd = np.cos(dec), np.sin(dec)
     46        ca, sa = np.cos(ra - _angp), np.sin(ra - _angp)
     47
     48        sb = cd*_ce*ca + sd*_se
     49        l = np.arctan2(sd - sb*_se, cd*sa*_ce) + _l0
     50        b = np.arcsin(sb)
     51
     52        l = np.where(l < 0, l + 2.*np.pi, l)
     53
     54        l = np.degrees(l)
     55        b = np.degrees(b)
     56
     57        return NamedList(('l', l), ('b', b))
     58
     59def galequ(l, b):
     60        l = np.radians(l)
     61        b = np.radians(b)
     62
     63        cb, sb = np.cos(b), np.sin(b)
     64        cl, sl = np.cos(l-_l0), np.sin(l-_l0)
     65
     66        ra  = np.arctan2(cb*cl, sb*_ce-cb*_se*sl) + _angp
     67        dec = np.arcsin(cb*_ce*sl + sb*_se)
     68
     69        ra = np.where(ra < 0, ra + 2.*np.pi, ra)
     70
     71        ra = np.degrees(ra)
     72        dec = np.degrees(dec)
     73
     74        return NamedList(('ra', ra), ('dec', dec))
     75
     76 ***/
  • branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/find_matches_starpar.c

    r37417 r37422  
    151151  }
    152152
    153 # if (0)
     153# if (1)
    154154  /** incorporate unmatched image stars? **/
    155155  for (i = 0; (i < Nstars) && !options->only_match; i++) {
     
    157157    // skip already matched stars
    158158    if (stars[i].found != -1) continue;
    159     if (!IN_REGION (stars[i].average.R, stars[i].average.D)) continue;
     159    if (!IN_REGION (stars[i].R, stars[i].D)) continue;
    160160
    161161    /* make sure there is space for next entry */
    162162    if (Nstarpar >= NSTARPAR) {
    163163      NSTARPAR = Nstarpar + 1000;
    164       REALLOCATE (catalog[0].starpar, Starpar, NSTARPAR);
     164      REALLOCATE (catalog[0].starpar, StarPar, NSTARPAR);
    165165    }
    166166    if (Nave >= NAVE) {
  • branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/loadstarpar.c

    r37417 r37422  
    2525 
    2626  // load the list of hosts
    27   HostTable *hosts = HostTableLoad (CATDIR, sky->hosts);
    28   if (!hosts) {
    29     fprintf (stderr, "ERROR: failure reading Host Table %s for database %s\n", sky->hosts, CATDIR);
    30     exit (1);
    31   }   
     27  HostTable *hosts = NULL;
     28  if (PARALLEL) {
     29    hosts = HostTableLoad (CATDIR, sky->hosts);
     30    if (!hosts) {
     31      fprintf (stderr, "ERROR: failure reading Host Table %s for database %s\n", sky->hosts, CATDIR);
     32      exit (1);
     33    }   
     34
     35    // ensure that the paths are absolute path names
     36    for (i = 0; i < hosts->Nhosts; i++) {
     37      char *tmppath = abspath (hosts->hosts[i].pathname, DVO_MAX_PATH);
     38      free (hosts->hosts[i].pathname);
     39      hosts->hosts[i].pathname = tmppath;
     40    }
     41
     42    // set up the array of active hosts
     43    init_remote_hosts ();
     44  }
    3245
    3346  // generate the subset matching the user-selected region
  • branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/loadstarpar_make_subset.c

    r37417 r37422  
    3535    Nsubset ++;
    3636
     37    stars[i].flag = TRUE;
     38
    3739    CHECK_REALLOCATE (subset, StarPar_Stars, NSUBSET, Nsubset, 10000);
    3840  }
  • branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/loadstarpar_readstars.c

    r37417 r37422  
    4444    return (NULL);
    4545  }
    46   fclose (f);
    4746
    4847  char type[16];
     
    7574    return NULL;
    7675  }
     76  fclose (f);
    7777
    7878  double *errImage = (double *) matrix.buffer;
     
    9393  ALLOCATE (stars, StarPar_Stars, NSTARS);
    9494
     95  // libdvo uses Liu et al 2011 (A&A 526, A16) for default galactic coords,
     96  // but Greg Green / LSD use the older Reid et al 2004 (ApJ 616, 872) definition
     97  CoordTransform *transform = InitTransform (COORD_GALACTIC_REID_2004, COORD_CELESTIAL);
     98
    9599  for (i = 0; i < NstarsIn; i++) {
    96100
     
    100104
    101105    double R, D;
    102     galactic_to_celestial (&R, &D, glon[i], glat[i]);
     106    ApplyTransform (&R, &D, glon[i], glat[i], transform);
    103107
    104108    Rmin = MIN (Rmin, R);
     
    114118    stars[Nstars].R = R;
    115119    stars[Nstars].D = D;
     120    stars[Nstars].flag  = FALSE;
     121    stars[Nstars].found = FALSE;
    116122
    117123    stars[Nstars].starpar.galLon = glon[i];
  • branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/loadstarpar_save_remote.c

    r37417 r37422  
    2424
    2525  // if this region is a parallel thing, save and launch remote
    26   if (!region->hostID) {
     26  if (!PARALLEL) {
    2727    loadstarpar_catalog (stars, Nstars, region, fullname, options);
    2828  } else {
     
    6161    // got a valid slot, so launch a new host
    6262
    63     // XXX do this after we load the host table:
    64     // ensure that the paths are absolute path names
    65     // char *tmppath = abspath (table->hosts[i].pathname, DVO_MAX_PATH);
    66     // free (table->hosts[i].pathname);
    67     // table->hosts[i].pathname = tmppath;
    68 
    6963    // need to generate the remote command
    7064    char command[1024];
Note: See TracChangeset for help on using the changeset viewer.