IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 32862


Ignore:
Timestamp:
Dec 2, 2011, 3:42:39 PM (15 years ago)
Author:
eugene
Message:

create specpairfit for spectral matching

Location:
branches/eam_branches/ipp-20111122/Ohana/src/opihi/cmd.astro
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20111122/Ohana/src/opihi/cmd.astro/Makefile

    r32632 r32862  
    3333$(SRC)/fixcols.$(ARCH).o           \
    3434$(SRC)/gauss.$(ARCH).o             \
    35 $(SRC)/getvel.$(ARCH).o    \
    36 $(SRC)/getlst.$(ARCH).o    \
     35$(SRC)/getvel.$(ARCH).o            \
     36$(SRC)/getlst.$(ARCH).o            \
    3737$(SRC)/medianmap.$(ARCH).o         \
    3838$(SRC)/mkgauss.$(ARCH).o           \
     
    5151$(SRC)/precess.$(ARCH).o           \
    5252$(SRC)/profile.$(ARCH).o           \
    53 $(SRC)/radec.$(ARCH).o     \
    54 $(SRC)/region.$(ARCH).o    \
     53$(SRC)/radec.$(ARCH).o             \
     54$(SRC)/region.$(ARCH).o            \
    5555$(SRC)/rotcurve.$(ARCH).o          \
    5656$(SRC)/scale.$(ARCH).o             \
    5757$(SRC)/sexigesimal.$(ARCH).o       \
    5858$(SRC)/spec.$(ARCH).o              \
     59$(SRC)/specpairfit.$(ARCH).o       \
    5960$(SRC)/star.$(ARCH).o              \
    60 $(SRC)/transform.$(ARCH).o        \
     61$(SRC)/transform.$(ARCH).o         \
    6162$(SRC)/imsub.$(ARCH).o             \
    6263$(SRC)/imfit.$(ARCH).o             \
  • branches/eam_branches/ipp-20111122/Ohana/src/opihi/cmd.astro/init.c

    r32632 r32862  
    4545int sexigesimal             PROTO((int, char **));
    4646int spec                    PROTO((int, char **));
     47int specpairfit             PROTO((int, char **));
    4748int star                    PROTO((int, char **));
    4849int times                   PROTO((int, char **));
     
    9394  {1, "sexigesimal", sexigesimal,  "convert to/from sexigesimal/decimal"},
    9495  {1, "spec",        spec,         "extract a spectrum"},
     96  {1, "specpairfit", specpairfit,  "fit spectrum to another spectrum"},
    9597  {1, "star",        star,         "star stats at rough coords"},
    9698  {1, "transform",   transform,    "geometric transformation of image"},
  • branches/eam_branches/ipp-20111122/Ohana/src/opihi/cmd.astro/specpairfit.c

    r32849 r32862  
    33int specpairfit (int argc, char **argv) {
    44 
     5  int i;
    56  Vector *flux1, *flux2, *dflux1, *dflux2, *window;
    67
    7   if (argc != 2) goto usage;
     8  if (argc != 7) goto usage;
    89
    910  if ((flux1  = SelectVector (argv[1], OLDVECTOR, TRUE)) == NULL) goto escape;
     
    1314  if ((window = SelectVector (argv[5], OLDVECTOR, TRUE)) == NULL) goto escape;
    1415 
    15   mask = atoi (argv[6]);
     16  int mask = atoi (argv[6]);
     17  CastVector (window, OPIHI_INT);
    1618
    1719  // minimize (flux1 - flux2*alpha) in window defined by mask
     
    2224  for (i = 0; i < flux1->Nelements; i++) {
    2325    if ((mask & window->elements.Int[i]) == 0) continue;
    24     weight = 1.0 / (SQ(dflux1->elements.Flt[i]) + SQ(dflux2->elements.Flt[i]));
     26    double weight = 1.0 / (SQ(dflux1->elements.Flt[i]) + SQ(dflux2->elements.Flt[i]));
    2527    F12 += flux1->elements.Flt[i] * flux2->elements.Flt[i] * weight;
    2628    F22 += flux2->elements.Flt[i] * flux2->elements.Flt[i] * weight;
     
    3436  for (i = 0; i < flux1->Nelements; i++) {
    3537    if ((mask & window->elements.Int[i]) == 0) continue;
    36     weight = 1.0 / (SQ(dflux1->elements.Flt[i]) + SQ(dflux2->elements.Flt[i]));
     38    double weight = 1.0 / (SQ(dflux1->elements.Flt[i]) + SQ(dflux2->elements.Flt[i]));
    3739    chisq += (flux1->elements.Flt[i] - Ao * flux2->elements.Flt[i]) * weight;
    3840    Ndof ++;
Note: See TracChangeset for help on using the changeset viewer.