IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4470


Ignore:
Timestamp:
Jul 6, 2005, 2:37:31 PM (21 years ago)
Author:
eugene
Message:

added -cpt options to dvo extraction functions

Location:
trunk/Ohana/src/opihi
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/cmd.basic/macro.c

    r2598 r4470  
    3030  }
    3131
    32   /* sub-command was not found, pass argv[1..N] to macro create,
    33      make argv[0] say "create" to be consistent (probably not needed) */
    34   REALLOCATE (argv[0], char, 8);
    35   strcpy (argv[0], "create");
     32  /* sub-command was not found, pass argv[1..N] to macro_create */
    3633  status = macro_create (argc, argv);
    3734  return (status);
    3835}
    39 
    4036
    4137/* macro is called with the command "macro". 
  • trunk/Ohana/src/opihi/dvo/ccd.c

    r3462 r4470  
    99  Vector *xvec, *yvec;
    1010
    11   char filename[256], catdir[256];
     11  char filename[256], catdir[256], *CPTfile;
    1212  double Radius;
    1313  double *M1, *M2;
    14   int i, m, k, Npts, NPTS;
     14  int i, m, k, Npts, NPTS, N;
    1515  int N1, N2, i1, i2, mode[4];
    1616  int Ngraph, Nsec, Nregions, UseAverages;
     
    3333  VarConfig ("CATDIR", "%s", catdir);
    3434
     35  /* check for CPT selection */
     36  CPTfile = NULL;
     37  if (N = get_argument (argc, argv, "-cpt")) {
     38    remove_argument (N, &argc, argv);
     39    CPTfile = strcreate (argv[N]);
     40    remove_argument (N, &argc, argv);
     41  }   
     42
    3543  /* interpret command-line options */
    3644  if (!SetPhotSelections (&argc, argv)) goto usage;
     
    4755  if ((mode[2] == MAG_AVE) || (mode[2] == MAG_REF)) UseAverages = TRUE;
    4856
    49   /* find catalog files which overlap this region */
    50   Radius = MAX (fabs(graphsky.xmax), fabs(graphsky.ymax));
    51   regions = find_regions (graphsky.coords.crval1, graphsky.coords.crval2, Radius, &Nregions);
     57  /* determine region-file names */
     58  if (CPTfile == NULL) {
     59    float Radius;
     60    Radius = MAX (fabs(graphsky.xmax), fabs(graphsky.ymax));
     61    regions = find_regions (graphsky.coords.crval1, graphsky.coords.crval2, Radius, &Nregions);
     62  } else {
     63    Nregions = 1;
     64    ALLOCATE (regions, RegionFile, 1);
     65    strcpy (regions[0].name, CPTfile);
     66  }
    5267
    5368  /* init vectors to save data */
  • trunk/Ohana/src/opihi/dvo/cmd.c

    r3462 r4470  
    99  Vector *xvec, *yvec;
    1010
    11   char filename[256], catdir[256];
     11  char filename[256], catdir[256], *CPTfile;
    1212  double Radius, *M1, *M3;
    13   int i, j, m, i1, i3, N1, N3;
     13  int i, j, m, i1, i3, N1, N3, N;
    1414  int Npts, NPTS, mode[3];
    1515  int Ngraph, Nsec, Nregions;
     
    3232  VarConfig ("CATDIR", "%s", catdir);
    3333
     34  /* check for CPT selection */
     35  CPTfile = NULL;
     36  if (N = get_argument (argc, argv, "-cpt")) {
     37    remove_argument (N, &argc, argv);
     38    CPTfile = strcreate (argv[N]);
     39    remove_argument (N, &argc, argv);
     40  }   
     41
    3442  /* interpret command-line options */
    3543  if (!SetPhotSelections (&argc, argv)) goto usage;
     
    4351  if (!GetPhotcodeInfo (argv[5], &code[2], &mode[2])) return (FALSE);
    4452
    45   /* find catalog files which overlap this region */
    46   Radius = MAX (fabs(graphsky.xmax), fabs(graphsky.ymax));
    47   regions = find_regions (graphsky.coords.crval1, graphsky.coords.crval2, Radius, &Nregions);
     53  /* determine region-file names */
     54  if (CPTfile == NULL) {
     55    float Radius;
     56    Radius = MAX (fabs(graphsky.xmax), fabs(graphsky.ymax));
     57    regions = find_regions (graphsky.coords.crval1, graphsky.coords.crval2, Radius, &Nregions);
     58  } else {
     59    Nregions = 1;
     60    ALLOCATE (regions, RegionFile, 1);
     61    strcpy (regions[0].name, CPTfile);
     62  }
    4863
    4964  /* init vectors to save data */
  • trunk/Ohana/src/opihi/dvo/dmagaves.c

    r4420 r4470  
    99  Vector *xvec, *yvec;
    1010
    11   char filename[256], catdir[256];
     11  char filename[256], catdir[256], *CPTfile;
    1212  double Radius, *M1, M2;
    13   int i, j, k, m, N1;
     13  int i, j, k, m, N1, N;
    1414  int Npts, NPTS, param, mode[3];
    1515  int Ngraph, Nsec, Nregions;
     
    3131  /* find CATDIR in config system */
    3232  VarConfig ("CATDIR", "%s", catdir);
     33
     34  /* check for CPT selection */
     35  CPTfile = NULL;
     36  if (N = get_argument (argc, argv, "-cpt")) {
     37    remove_argument (N, &argc, argv);
     38    CPTfile = strcreate (argv[N]);
     39    remove_argument (N, &argc, argv);
     40  }   
    3341
    3442  /* interpret command-line options */
     
    5765  }
    5866
    59   /* find catalog files which overlap this region */
    60   Radius = MAX (fabs(graphsky.xmax), fabs(graphsky.ymax));
    61   regions = find_regions (graphsky.coords.crval1, graphsky.coords.crval2, Radius, &Nregions);
    62   if (!SetImageSelection (param, &graphsky, TRUE)) return (FALSE);
    63  
     67  /* determine region-file names */
     68  if (CPTfile == NULL) {
     69    float Radius;
     70    Radius = MAX (fabs(graphsky.xmax), fabs(graphsky.ymax));
     71    regions = find_regions (graphsky.coords.crval1, graphsky.coords.crval2, Radius, &Nregions);
     72  } else {
     73    Nregions = 1;
     74    ALLOCATE (regions, RegionFile, 1);
     75    strcpy (regions[0].name, CPTfile);
     76  }
     77
    6478  /* init vectors to save data */
    6579  Npts = 0;
  • trunk/Ohana/src/opihi/dvo/dmagmeas.c

    r3462 r4470  
    1010  Vector *xvec, *yvec;
    1111
    12   char filename[256], catdir[256];
     12  char filename[256], catdir[256], *CPTfile;
    1313  double Radius, *M1, *M3;
    14   int i, j, k, m, N1, N3;
     14  int i, j, k, m, N1, N3, N;
    1515  int Npts, NPTS, param, mode[3];
    1616  int Ngraph, Nsec, Nregions;
     
    3232  /* find CATDIR in config system */
    3333  VarConfig ("CATDIR", "%s", catdir);
     34
     35  /* check for CPT selection */
     36  CPTfile = NULL;
     37  if (N = get_argument (argc, argv, "-cpt")) {
     38    remove_argument (N, &argc, argv);
     39    CPTfile = strcreate (argv[N]);
     40    remove_argument (N, &argc, argv);
     41  }   
    3442
    3543  /* interpret command-line options */
     
    5361  }
    5462
    55   /* find catalog files which overlap this region */
    56   Radius = MAX (fabs(graphsky.xmax), fabs(graphsky.ymax));
    57   regions = find_regions (graphsky.coords.crval1, graphsky.coords.crval2, Radius, &Nregions);
     63  /* determine region-file names */
     64  if (CPTfile == NULL) {
     65    float Radius;
     66    Radius = MAX (fabs(graphsky.xmax), fabs(graphsky.ymax));
     67    regions = find_regions (graphsky.coords.crval1, graphsky.coords.crval2, Radius, &Nregions);
     68  } else {
     69    Nregions = 1;
     70    ALLOCATE (regions, RegionFile, 1);
     71    strcpy (regions[0].name, CPTfile);
     72  }
    5873  if (!SetImageSelection (param, &graphsky, TRUE)) return (FALSE);
    5974
  • trunk/Ohana/src/opihi/dvo/dmags.c

    r3462 r4470  
    99  Vector *xvec, *yvec;
    1010
    11   char filename[256], catdir[256];
     11  char filename[256], catdir[256], *CPTfile;
    1212  double Radius, *M1, *M3;
    13   int i, j, m, i1, i3, N1, N3;
     13  int i, j, m, i1, i3, N1, N3, N;
    1414  int Npts, NPTS, mode[3];
    1515  int Ngraph, Nsec, Nregions;
     
    3131  /* find CATDIR in config system */
    3232  VarConfig ("CATDIR", "%s", catdir);
     33
     34  /* check for CPT selection */
     35  CPTfile = NULL;
     36  if (N = get_argument (argc, argv, "-cpt")) {
     37    remove_argument (N, &argc, argv);
     38    CPTfile = strcreate (argv[N]);
     39    remove_argument (N, &argc, argv);
     40  }   
    3341
    3442  /* interpret command-line options */
     
    5260  }
    5361
    54   /* find catalog files which overlap this region */
    55   Radius = MAX (fabs(graphsky.xmax), fabs(graphsky.ymax));
    56   regions = find_regions (graphsky.coords.crval1, graphsky.coords.crval2, Radius, &Nregions);
     62  /* determine region-file names */
     63  if (CPTfile == NULL) {
     64    float Radius;
     65    Radius = MAX (fabs(graphsky.xmax), fabs(graphsky.ymax));
     66    regions = find_regions (graphsky.coords.crval1, graphsky.coords.crval2, Radius, &Nregions);
     67  } else {
     68    Nregions = 1;
     69    ALLOCATE (regions, RegionFile, 1);
     70    strcpy (regions[0].name, CPTfile);
     71  }
    5772
    5873  /* init vectors to save data */
  • trunk/Ohana/src/opihi/lib.shell/command.c

    r4462 r4470  
    55
    66  int i, status, argc;
    7   char **argv;
     7  char **argv, **targv;
    88  Command *cmd;
    99
     
    2929  if (argc == 0) return (TRUE);  /* empty command or assignment */
    3030
     31  /* save the original values of argv since command may modify the array */
     32  ALLOCATE (targv, char *, argc);
     33  for (i = 0; i < argc; i++) targv[i] = argv[i];
     34
    3135  cmd = MatchCommand (argv[0], TRUE, FALSE);
    3236  if (cmd == NULL) {
     
    3539    free (argv[0]);
    3640    argv[0] = strcreate (cmd[0].name);
     41    targv[0] = argv[0];
    3742    status = (*cmd[0].func) (argc, argv);
    3843  }
    39   for (i = 0; i < argc; i++) free (argv[i]);
     44  for (i = 0; i < argc; i++) free (targv[i]);
     45  free (targv);
    4046  free (argv);
    4147
Note: See TracChangeset for help on using the changeset viewer.