IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 17, 2014, 12:30:45 PM (12 years ago)
Author:
eugene
Message:

merge changes (from past YEAR) into trunk

Location:
branches/eam_branches/ipp-ops-20130712/psModules
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-ops-20130712/psModules

    • Property svn:mergeinfo deleted
  • branches/eam_branches/ipp-ops-20130712/psModules/src/extras/pmVisual.c

    r34403 r37066  
    2222bool pmSourceVisualClose(void);
    2323
    24 // #include "pmHDU.h"
    25 // #include "pmFPA.h"
    26 // #include "pmFPAfile.h"
    27 // #include "pmAstrometryObjects.h"
    28 // #include "pmSubtractionStamps.h"
    29 // #include "pmTrend2D.h"
    30 // #include "pmResiduals.h"
    31 // #include "pmGrowthCurve.h"
    32 // #include "pmSpan.h"
    33 // #include "pmFootprintSpans.h"
    34 // #include "pmFootprint.h"
    35 // #include "pmPeaks.h"
    36 // #include "pmMoments.h"
    37 // #include "pmModelFuncs.h"
    38 // #include "pmModel.h"
    39 // #include "pmSourceMasks.h"
    40 // #include "pmSourceExtendedPars.h"
    41 // #include "pmSourceDiffStats.h"
    4224#include "pmSourceSatstar.h"
    43 // #include "pmSource.h"
    44 // #include "pmSourceFitModel.h"
    45 // #include "pmPSF.h"
    46 // #include "pmPSFtry.h"
    47 // #include "pmFPAExtent.h"
    48 // #include "pmAstrometryVisual.h"
    49 // #include "pmSubtractionVisual.h"
    50 // #include "pmStackVisual.h"
    51 // #include "pmSourceVisual.h"
    5225
    5326# if (HAVE_KAPA)
     
    160133}
    161134
     135
     136// ask the user to continue or not.  give up after 2 seconds.
     137bool pmVisualAskUserOrDump(bool *plotFlag, bool *dumpData)
     138{
     139    struct timeval timeout;
     140    fd_set fdSet;
     141    int status;
     142
     143    if (dumpData) *dumpData = false;
     144
     145    char key[10];
     146    if (plotFlag && dumpData) {
     147        fprintf (stderr, "[p]ause? [c]ontinue? [s]kip the rest of these plots? [d]ump the data? [a]bort all visual plots? (c) ");
     148    }
     149    if (plotFlag && !dumpData) {
     150        fprintf (stderr, "[p]ause? [c]ontinue? [s]kip the rest of these plots? [a]bort all visual plots? (c) ");
     151    }
     152    if (!plotFlag && dumpData) {
     153        fprintf (stderr, "[p]ause? [c]ontinue? [d]ump the data? [a]bort all visual plots? (c) ");
     154    }
     155    if (!plotFlag && !dumpData) {
     156        fprintf (stderr, "[p]ause? [c]ontinue? [a]bort all visual plots? (c) ");
     157    }
     158
     159    /* Wait up to 1.0 second for a response, then continue */
     160    timeout.tv_sec = 10;
     161    timeout.tv_usec = 0;
     162
     163    FD_ZERO (&fdSet);
     164    FD_SET (STDIN_FILENO, &fdSet);
     165
     166    status = select (1, &fdSet, NULL, NULL, &timeout);
     167    if (status <= 0) {
     168        fprintf (stderr, "\n");
     169        return true; // if no data, give up
     170    }
     171
     172    while (true) {
     173        if (!fgets(key, 8, stdin)) {
     174            psWarning("Unable to read option");
     175        }
     176        switch (key[0]) {
     177          case 's':
     178            if (plotFlag) *plotFlag = false;
     179            return true;
     180          case 'd':
     181            if (dumpData) *dumpData = true;
     182            return true;
     183          case 'a':
     184            isVisual = false;
     185            return true;
     186          case 'c':
     187          case '\n':
     188            return true;
     189          default:
     190            break;
     191        }
     192       
     193        if (plotFlag && dumpData) {
     194          fprintf (stderr, "[p]ause? [c]ontinue? [s]kip the rest of these plots? [d]ump the data? [a]bort all visual plots? (c) ");
     195        }
     196        if (plotFlag && !dumpData) {
     197          fprintf (stderr, "[p]ause? [c]ontinue? [s]kip the rest of these plots? [a]bort all visual plots? (c) ");
     198        }
     199        if (!plotFlag && dumpData) {
     200          fprintf (stderr, "[p]ause? [c]ontinue? [d]ump the data? [a]bort all visual plots? (c) ");
     201        }
     202        if (!plotFlag && !dumpData) {
     203          fprintf (stderr, "[p]ause? [c]ontinue? [a]bort all visual plots? (c) ");
     204        }
     205    }
     206    return true;
     207}
    162208
    163209bool pmVisualImStats(psImage *image, double *mean, double *stdev, double *min, double *max) {
Note: See TracChangeset for help on using the changeset viewer.