IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 2, 2009, 3:15:42 PM (17 years ago)
Author:
eugene
Message:

various dvo and other improvements from gene@dev branch

Location:
trunk/Ohana/src/opihi
Files:
17 edited
12 copied

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/cmd.astro/Makefile

    r21061 r25757  
    2121$(SRC)/cgrid.$(ARCH).o             \
    2222$(SRC)/coords.$(ARCH).o    \
     23$(SRC)/cdot.$(ARCH).o              \
    2324$(SRC)/cplot.$(ARCH).o             \
    2425$(SRC)/csystem.$(ARCH).o           \
     
    3637$(SRC)/medianmap.$(ARCH).o         \
    3738$(SRC)/mkgauss.$(ARCH).o           \
     39$(SRC)/mksersic.$(ARCH).o          \
     40$(SRC)/galradius.$(ARCH).o         \
     41$(SRC)/galradbins.$(ARCH).o        \
     42$(SRC)/galsectors.$(ARCH).o        \
     43$(SRC)/galprofiles.$(ARCH).o       \
     44$(SRC)/elliprofile.$(ARCH).o       \
     45$(SRC)/petrosian.$(ARCH).o         \
    3846$(SRC)/multifit.$(ARCH).o          \
    3947$(SRC)/objload.$(ARCH).o           \
  • trunk/Ohana/src/opihi/cmd.astro/cgrid.c

    r20936 r25757  
    3737  /* set spacings for RA */
    3838  minorRA = minorDEC = 0.1;
    39   range = MIN (fabs(graphmode.xmax-graphmode.xmin), fabs(graphmode.ymax-graphmode.ymin));
     39  range = MIN (fabs(graphmode.coords.cdelt1*(graphmode.xmax-graphmode.xmin)), fabs(graphmode.coords.cdelt2*(graphmode.ymax-graphmode.ymin)));
    4040  if (NorthPole || SouthPole) range = 360;
    4141  lrange = log10(MAX(fabs(range), 1e-30));
     
    5858  }
    5959  dR = range / 100.0;
     60
    6061  /* set spacings for DEC */
    61   range = MIN (fabs(graphmode.xmax-graphmode.xmin), fabs(graphmode.ymax-graphmode.ymin));
     62  range = MIN (fabs(graphmode.coords.cdelt1*(graphmode.xmax-graphmode.xmin)), fabs(graphmode.coords.cdelt2*(graphmode.ymax-graphmode.ymin)));
    6263  lrange = log10(MAX(fabs(range), 1e-30));
    6364  factor = (int) (lrange);
  • trunk/Ohana/src/opihi/cmd.astro/init.c

    r21061 r25757  
    55int cgrid                   PROTO((int, char **));
    66int coords                  PROTO((int, char **));
     7int cdot                    PROTO((int, char **));
    78int cplot                   PROTO((int, char **));
    89int csystem                 PROTO((int, char **));
     
    2223int imsub                   PROTO((int, char **));
    2324int medianmap               PROTO((int, char **));
     25int galsectors              PROTO((int, char **));
     26int galprofiles             PROTO((int, char **));
     27int galradius               PROTO((int, char **));
     28int galradbins              PROTO((int, char **));
     29int elliprofile             PROTO((int, char **));
     30int petrosian               PROTO((int, char **));
    2431int mkgauss                 PROTO((int, char **));
     32int mksersic                PROTO((int, char **));
    2533int multifit                PROTO((int, char **));
    2634int objload                 PROTO((int, char **));
     
    4452  {1, "cgrid",       cgrid,        "plot sky coordinate grid"},
    4553  {1, "coords",      coords,       "load coordinates for buffer from file"},
     54  {1, "cdot",        cdot,         "plot point in sky coordinates"},
    4655  {1, "cplot",       cplot,        "plot vectors in sky coordinates"},
    4756  {1, "csystem",     csystem,      "convert between coordinate systems"},
     
    6170  {1, "medianmap",   medianmap,    "small median image"},
    6271  {1, "mkgauss",     mkgauss,      "generate a 2-D gaussian centered in image"},
     72  {1, "mksersic",    mksersic,     "generate a 2-D sersic profile"},
     73  {1, "galsectors",  galsectors,   "generate radial vectors for sectors of width dtheta"},
     74  {1, "galprofiles", galprofiles,  "generate radial vectors with interpolation along paths"},
     75  {1, "galradius",   galradius,    "generate radial vectors with interpolation along paths"},
     76  {1, "galradbins",  galradbins,   "generate radial vectors with interpolation along paths"},
     77  {1, "elliprofile", elliprofile,  "generate radial vectors with interpolation along paths"},
     78  {1, "petrosian",   petrosian,    "petrosian parameters given radial bins"},
    6379  {1, "multifit",    multifit,     "fit multi-order spectrum"},
    6480  {1, "objload",     objload,      "plot obj data on Ximage "},
  • trunk/Ohana/src/opihi/cmd.astro/region.c

    r14590 r25757  
    66  double Ra, Dec, Radius;
    77  float dx, dy;
    8   int N, kapa;
     8  int N, kapa, NoClear;
    99  char *name;
    1010  Graphdata graphmode;
     
    4646    remove_argument (N, &argc, argv);
    4747    graphmode.flipnorth = FALSE;
     48  }
     49
     50  NoClear = FALSE;
     51  if ((N = get_argument (argc, argv, "-no-clear"))) {
     52    remove_argument (N, &argc, argv);
     53    NoClear = TRUE;
    4854  }
    4955
     
    122128  graphmode.coords.cdelt1 = graphmode.coords.cdelt2 = 1.0;
    123129
    124   KapaClearSections (kapa);
     130  if (!NoClear) KapaClearSections (kapa);
    125131  KapaSetLimits (kapa, &graphmode);
    126132
    127133  /* drop this? */
    128   sprintf (string, "%8.4f %8.4f (%f)", Ra, Dec, Radius);
    129   KapaSendLabel (kapa, string, 2);
     134  // sprintf (string, "%8.4f %8.4f (%f)", Ra, Dec, Radius);
     135  // KapaSendLabel (kapa, string, 2);
    130136
    131137  // XXX is this the right thing to be doing?
  • trunk/Ohana/src/opihi/cmd.basic/substr.c

    r18705 r25757  
    1616  // add a range check here
    1717  if ((N1 < 0) || (N1 >=  strlen(argv[1]))) {
    18       gprint (GP_ERR, "ERROR: N1 out of range\n");
     18      gprint (GP_ERR, "ERROR: start value out of range in substr command\n");
    1919      return (FALSE);
    2020  }
    2121  if ((N2 < 0) || ((N2+N1) >  strlen(argv[1]))) {
    22       gprint (GP_ERR, "ERROR: N2 out of range\n");
     22      gprint (GP_ERR, "ERROR: end value out of range in substr command\n");
    2323      return (FALSE);
    2424  }
  • trunk/Ohana/src/opihi/cmd.data/Makefile

    r21508 r25757  
    9797$(SRC)/rebin.$(ARCH).o          \
    9898$(SRC)/resize.$(ARCH).o \
     99$(SRC)/relocate.$(ARCH).o       \
    99100$(SRC)/roll.$(ARCH).o           \
    100101$(SRC)/rotate.$(ARCH).o \
     
    110111$(SRC)/style.$(ARCH).o             \
    111112$(SRC)/subraster.$(ARCH).o         \
    112 $(SRC)/subset.$(ARCH).o    \
     113$(SRC)/subset.$(ARCH).o            \
    113114$(SRC)/svd.$(ARCH).o               \
    114115$(SRC)/swapbytes.$(ARCH).o         \
     
    118119$(SRC)/tvcolors.$(ARCH).o          \
    119120$(SRC)/tvcontour.$(ARCH).o         \
    120 $(SRC)/tvgrid.$(ARCH).o    \
     121$(SRC)/tvgrid.$(ARCH).o            \
    121122$(SRC)/uniq.$(ARCH).o              \
    122 $(SRC)/unsign.$(ARCH).o    \
     123$(SRC)/unsign.$(ARCH).o            \
    123124$(SRC)/vbin.$(ARCH).o              \
     125$(SRC)/vgroup.$(ARCH).o            \
    124126$(SRC)/vclip.$(ARCH).o             \
    125 $(SRC)/vgauss.$(ARCH).o           \
    126 $(SRC)/vmaxwell.$(ARCH).o           \
     127$(SRC)/vgauss.$(ARCH).o            \
     128$(SRC)/vellipse.$(ARCH).o          \
     129$(SRC)/vmaxwell.$(ARCH).o          \
    127130$(SRC)/vgrid.$(ARCH).o             \
    128131$(SRC)/vload.$(ARCH).o             \
     
    130133$(SRC)/vpop.$(ARCH).o              \
    131134$(SRC)/vroll.$(ARCH).o             \
    132 $(SRC)/vsmooth.$(ARCH).o        \
     135$(SRC)/vsmooth.$(ARCH).o           \
    133136$(SRC)/vstats.$(ARCH).o            \
    134137$(SRC)/wd.$(ARCH).o                \
  • trunk/Ohana/src/opihi/cmd.data/init.c

    r24219 r25757  
    8585int rebin            PROTO((int, char **));
    8686int resize           PROTO((int, char **));
     87int relocate         PROTO((int, char **));
    8788int roll             PROTO((int, char **));
    8889int rotate           PROTO((int, char **));
     
    110111int unsign           PROTO((int, char **));
    111112int vbin             PROTO((int, char **));
     113int vgroup           PROTO((int, char **));
    112114int vclip            PROTO((int, char **));
    113115int vect_select      PROTO((int, char **));
    114116int vgrid            PROTO((int, char **));
    115117int vgauss           PROTO((int, char **));
     118int vellipse         PROTO((int, char **));
    116119int vmaxwell         PROTO((int, char **));
    117120int vload            PROTO((int, char **));
     
    218221  {1, "rebin",        rebin,            "rebin image data by factor of N"},
    219222  {1, "resize",       resize,           "set graphics/image window size"},
     223  {1, "relocate",     relocate,         "set graphics/image window position"},
    220224  {1, "roll",         roll,             "roll image to new start point"},
    221225  {1, "rotate",       rotate,           "rotate image"},
     
    243247  {1, "uniq",         uniq,             "create a uniq vector subset from a vector"},
    244248  {1, "unsign",       unsign,           "toggle the UNSIGN status"},
    245   {1, "vbin",         vbin,             "rebin vector data by a fector of N"},
     249  {1, "vbin",         vbin,             "rebin vector data by a factor of N"},
     250  {1, "vgroup",       vgroup,           "group y vector into bins defined by x vector values"},
    246251  {1, "vclip",        vclip,            "clip values in a vector to be within a range"},
    247252  {1, "vectors",      list_vectors,     "list vectors"},
    248253  {1, "vgauss",       vgauss,           "fit a Gaussian to a vector"},
     254  {1, "vellipse",     vellipse,         "fit a Ellipse to a vector pair"},
    249255  {1, "vgrid",        vgrid,            "generate an image from a triplet of vectors"},
    250256  {1, "vhistogram",   histogram,        "generate histogram from vector"},
  • trunk/Ohana/src/opihi/cmd.data/subset.c

    r20936 r25757  
    66 
    77  char *out;
    8   int  i, Npts, size;
     8  int  i, Npts, size, valid;
    99  Vector *ivec, *ovec, *tvec;
    1010
     
    1212  ivec = ovec = tvec = NULL;
    1313
    14   if ((argc < 6) || strcmp(argv[2], "=") || strcmp (argv[4], "if")) {
    15     gprint (GP_ERR, "SYNTAX: subset vec = vec if (logic expression)\n");
     14  valid = TRUE;
     15  valid &= (argc >= 6);
     16  valid &= !strcmp(argv[2], "=");
     17  valid &= !strcmp(argv[4], "if") || !strcmp (argv[4], "where");
     18  if (!valid) {
     19    gprint (GP_ERR, "SYNTAX: subset vec = vec [if/where] (logic expression)\n");
    1620    return (FALSE);
    1721  }
     
    7680  return (TRUE);
    7781
    78  error:
     82error:
    7983  DeleteVector (tvec);
    8084  DeleteVector (ovec);
  • trunk/Ohana/src/opihi/cmd.data/tvcolors.c

    r16059 r25757  
    1919  if (argc != 2) {
    2020    gprint (GP_ERR, "USAGE: tvcolors (colormap)\n");
     21    gprint (GP_ERR, " colormap options : greyscale, -greyscale, rainbow, heat, fullcolor, ruffcolor (also grayscale, -grayscale)\n");
    2122    return (FALSE);
    2223  }
  • trunk/Ohana/src/opihi/dvo/Makefile

    r20936 r25757  
    7373$(SRC)/imrough.$(ARCH).o                \
    7474$(SRC)/imsearch.$(ARCH).o               \
    75 $(SRC)/imstats.$(ARCH).o                \
    7675$(SRC)/lcat.$(ARCH).o                   \
    7776$(SRC)/lcurve.$(ARCH).o         \
  • trunk/Ohana/src/opihi/dvo/gimages.c

    r21508 r25757  
    124124      }
    125125
     126      // find coordinates of image center
    126127      XY_to_RD (&Ro, &Do, Xo, Yo, &image[i].coords);
     128      if (fabs(Ro - Ra) > 120.0) continue;
    127129
    128130      local.crval1 = Ro;
     
    138140        Xs = -0.5*image[i].NX;
    139141        Ys = -0.5*image[i].NY;
    140         Xe = +0.5*image[i].NX;
    141         Ye = +0.5*image[i].NY;
    142142      } else {
    143143        Xs = 0.0;
    144144        Ys = 0.0;
    145         Xe = image[i].NX;
    146         Ye = image[i].NY;
    147145      }
    148146     
     147      // find coordinates of an image corner
    149148      XY_to_RD (&Ro, &Do, Xs, Ys, &image[i].coords);
    150       RD_to_XY (&Xo, &Xo, Ro, Do, &local);
     149
     150      // find radius of image in arcsec
     151      RD_to_XY (&Xo, &Yo, Ro, Do, &local);
    151152      Radius = hypot (Xo, Yo);
    152153      // fprintf (stderr, "%s: %f %f    %f ", image[i].name, local.crval1, local.crval2, Radius);
    153154
    154       XY_to_RD (&Ro, &Do, Xs, Ye, &image[i].coords);
    155       RD_to_XY (&Xo, &Xo, Ro, Do, &local);
    156       Radius = MAX (Radius, hypot (Xo, Yo));
    157       // fprintf (stderr, "%f ", Radius);
    158 
    159       XY_to_RD (&Ro, &Do, Xe, Ys, &image[i].coords);
    160       RD_to_XY (&Xo, &Xo, Ro, Do, &local);
    161       Radius = MAX (Radius, hypot (Xo, Yo));
    162       // fprintf (stderr, "%f ", Radius);
    163 
    164       XY_to_RD (&Ro, &Do, Xe, Ye, &image[i].coords);
    165       RD_to_XY (&Xo, &Xo, Ro, Do, &local);
    166       Radius = MAX (Radius, hypot (Xo, Yo));
    167       // fprintf (stderr, "%f ", Radius);
    168 
     155      // check for distances to coordinates in arcsec
    169156      RD_to_XY (&Xo, &Yo, Ra, Dec, &local);
    170157      // fprintf (stderr, " : %f\n", hypot(Xo,Yo));
     158
     159      // skip images with center too far from coordinaes
    171160      if (hypot(Xo,Yo) > 1.5*Radius) continue;
    172161      // fprintf (stderr, " ** try me **\n");
  • trunk/Ohana/src/opihi/dvo/imbox.c

    r21065 r25757  
    33int imbox (int argc, char **argv) {
    44 
    5   int j, kapa, Nskip, status, InPic, flipped, N, haveNx, haveNy, Nx, Ny, SOLO_PHU;
     5  int j, kapa, Nskip, status, InPic, flipped, N, haveNx, haveNy, Nx, Ny, SOLO_PHU, Npts, NPTS;
    66  Vector Xvec, Yvec;
    77  double r, d, x[4], y[4], Rmin, Rmax, Rmid;
     
    3636 
    3737  /* project this image to screen display coords */
    38   SetVector (&Xvec, OPIHI_FLT, 8);
    39   SetVector (&Yvec, OPIHI_FLT, 8);
     38  Npts = 0;
     39  NPTS = 200;
     40  SetVector (&Xvec, OPIHI_FLT, NPTS);
     41  SetVector (&Yvec, OPIHI_FLT, NPTS);
    4042
    4143  while (gfits_fread_header (f, &header)) {
     
    8284        while (r > Rmid) r-= 360.0;
    8385      }
    84       status |= RD_to_XY (&Xvec.elements.Flt[2*j], &Yvec.elements.Flt[2*j], r, d, &graphmode.coords);
     86      status |= RD_to_XY (&Xvec.elements.Flt[Npts + 2*j], &Yvec.elements.Flt[Npts + 2*j], r, d, &graphmode.coords);
    8587      if (j > 0) {
    86         Xvec.elements.Flt[2*j - 1] = Xvec.elements.Flt[2*j];
    87         Yvec.elements.Flt[2*j - 1] = Yvec.elements.Flt[2*j];
     88        Xvec.elements.Flt[Npts + 2*j - 1] = Xvec.elements.Flt[Npts + 2*j];
     89        Yvec.elements.Flt[Npts + 2*j - 1] = Yvec.elements.Flt[Npts + 2*j];
    8890      }
    8991    }
    90     Xvec.elements.Flt[7] = Xvec.elements.Flt[0];
    91     Yvec.elements.Flt[7] = Yvec.elements.Flt[0];
     92    Xvec.elements.Flt[Npts + 7] = Xvec.elements.Flt[Npts + 0];
     93    Yvec.elements.Flt[Npts + 7] = Yvec.elements.Flt[Npts + 0];
     94
    9295    InPic = FALSE;
    9396    for (j = 0; j < 8; j+=2) {
    94       if ((Xvec.elements.Flt[j] >= graphmode.xmin) &&
    95           (Xvec.elements.Flt[j] <= graphmode.xmax) &&
    96           (Yvec.elements.Flt[j] >= graphmode.ymin) &&
    97           (Yvec.elements.Flt[j] <= graphmode.ymax))
    98         InPic = TRUE;
     97      if ((Xvec.elements.Flt[Npts + j] >= graphmode.xmin) &&
     98          (Xvec.elements.Flt[Npts + j] <= graphmode.xmax) &&
     99          (Yvec.elements.Flt[Npts + j] >= graphmode.ymin) &&
     100          (Yvec.elements.Flt[Npts + j] <= graphmode.ymax))
     101        InPic = TRUE;
     102    }
     103    if (!InPic) continue;
     104
     105    Npts += 8;
     106    if (Npts + 8 >= NPTS) {  /* need to leave room for 4 point image */
     107      NPTS += 200;
     108      REALLOCATE (Xvec.elements.Flt, opihi_flt, NPTS);
     109      REALLOCATE (Yvec.elements.Flt, opihi_flt, NPTS);
    99110    }
    100111
    101     Xvec.Nelements = Yvec.Nelements = 8;
    102     if (InPic) {
    103       graphmode.style = 2; /* points */
    104       graphmode.ptype = 100; /* connect pairs of points */
    105       graphmode.etype = 0;
    106       PlotVectorPair (kapa, &Xvec, &Yvec, &graphmode);
    107     }
    108112  skip:
    109113    Nskip = gfits_data_size (&header);
     
    111115    gfits_free_header (&header);
    112116  }
     117
     118  Xvec.Nelements = Yvec.Nelements = Npts;
     119  if (Npts > 0) {
     120    graphmode.style = 2; /* points */
     121    graphmode.ptype = 100; /* connect pairs of points */
     122    graphmode.etype = 0;
     123    PlotVectorPair (kapa, &Xvec, &Yvec, &graphmode);
     124  }
     125
    113126  fclose (f);
    114127  free (Xvec.elements.Flt);
  • trunk/Ohana/src/opihi/dvo/init.c

    r21541 r25757  
    102102  {1, "subpix",      subpix,       "get subpixel positions"},
    103103  {1, "version",     version,      "show version information"},
    104 //{1, "imstats",     imstats,      "plot image statistics"},
    105104//{1, "addxtra",     addxtra,      "add extra data to object"},
    106105//{1, "getxtra",     getxtra,      "get extra data from object"},
  • trunk/Ohana/src/opihi/dvo/photometry.c

    r21508 r25757  
    325325    return (FALSE);
    326326  }
    327   if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile)) {
     327
     328  // XXX now that DVO does not allow write access, we can drop the MasterPhotcodeFile
     329  if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, FALSE)) {
    328330    gprint (GP_ERR, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile);
    329331    return (FALSE);
  • trunk/Ohana/src/opihi/dvo/region_list.c

    r15753 r25757  
    4242
    4343  if (sky != NULL) SkyTableFree (sky);
    44   sky = SkyTableLoadOptimal (CATDIR, skyfile, gscfile, skydepth, verbose);
     44  sky = SkyTableLoadOptimal (CATDIR, skyfile, gscfile, FALSE, skydepth, verbose);
    4545  if (sky == NULL) return FALSE;
    4646
  • trunk/Ohana/src/opihi/dvo/skycoverage.c

    r21153 r25757  
    1616  Coords coords;
    1717  int typehash;
     18  int PhotcodeSelect;
     19  PhotCode *PhotcodeValue;
    1820
    1921  WITH_MOSAIC = FALSE;
     
    4345    remove_argument (N, &argc, argv);
    4446    ByName = TRUE;
     47  }
     48
     49  PhotcodeValue = NULL;
     50  PhotcodeSelect = FALSE;
     51  if ((N = get_argument (argc, argv, "-photcode"))) {
     52    if (!InitPhotcodes ()) return (FALSE);
     53    PhotcodeSelect = TRUE;
     54    remove_argument (N, &argc, argv);
     55    PhotcodeValue = GetPhotcodebyName (argv[N]);
     56    if (PhotcodeValue == NULL) {
     57      gprint (GP_ERR, "photcode not found in photcode table\n");
     58      return (FALSE);
     59    }
     60    remove_argument (N, &argc, argv);
    4561  }
    4662
     
    85101 
    86102  if (argc != 4) {
    87     gprint (GP_ERR, "USAGE: skycoverage (buffer) (pixscale) (Npts) [-time start range] [-name name]\n");
     103    gprint (GP_ERR, "USAGE: skycoverage (buffer) (pixscale) (Npts)\n");
     104    gprint (GP_ERR, "  options: [-time start range] [-trange start stop] [-name name] [-photcode name] [+mosaic] [-mosaic] [-ra-center RA]\n");
    88105    gprint (GP_ERR, "       (buffer) saves bitmapped AIT plot\n");
    89106    gprint (GP_ERR, "       (pixscale) specifies the pixel size in degrees\n");
     
    128145    for (xs = 0; xs < Nx; xs++) {
    129146      status = XY_to_RD (&r, &d, (double)(xs), (double)(ys), &coords);
    130       status &= (r > 0);
    131       status &= (r < 360);
     147      status &= (r >= 0);
     148      status &= (r <= 360);
    132149      if (status) {
    133150        V[ys*Nx + xs] = 2;
     
    141158    if (ByName && strcmp (name, image[i].name)) continue;
    142159    if (TimeSelect && ((image[i].tzero < tzero) || (image[i].tzero+image[i].trate*image[i].NY > tzero + trange))) continue;
     160
     161    if (PhotcodeSelect) {
     162      if (PhotcodeValue[0].type == PHOT_DEP) {
     163        if (PhotcodeValue[0].code != image[i].photcode) continue;
     164      } else {
     165        if (PhotcodeValue[0].code != GetPhotcodeEquivCodebyCode (image[i].photcode)) continue;
     166      }
     167    }
     168
    143169    if (!FindMosaicForImage (image, Nimage, i)) continue;
    144170
     
    167193        XY_to_RD (&r, &d, Xi, Yi, &image[i].coords);
    168194        r = ohana_normalize_angle (r);
     195        if (r - RaCenter > +180.0) r -= 360.0;
     196        if (r - RaCenter < -180.0) r += 360.0;
    169197        status = RD_to_XY (&Xs, &Ys, r, d, &coords);
    170198        if (Xs < 0) continue;
  • trunk/Ohana/src/opihi/lib.data/mrqmin.c

    r20936 r25757  
    1717
    1818  int k, j, i;
    19   opihi_flt ydiff, wt, chisq;
     19  opihi_flt ymodel, ydiff, wt, chisq;
    2020
    2121  for (j = 0; j < Npar; j++) {
     
    2727  for (i = 0; i < Npts; i++) {
    2828
    29     ydiff = funcs (x[i], par, Npar, dyda) - y[i];
     29    ymodel = funcs (x[i], par, Npar, dyda);
     30    ydiff = ymodel - y[i];
    3031    chisq += SQ(ydiff) * dy[i];
     32
     33    // fprintf (stderr, "%f %f - %f : %f -> %f\n", x[i], y[i], ymodel, dy[i], chisq);
    3134
    3235    for (j = 0; j < Npar; j++) {
     
    8588
    8689  /* if good, save temp values */
    87   if (rho > 0) {
     90  if ((chisq > 1e-3) && (rho > -1e-6)) {
    8891    lambda *= 0.1;
    8992    ochisq = chisq;
Note: See TracChangeset for help on using the changeset viewer.