IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 13347


Ignore:
Timestamp:
May 10, 2007, 5:44:16 PM (19 years ago)
Author:
Paul Price
Message:

Filenames are provided in pmFPAfileIO.c --- these functions shouldn't be changing the file names.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/pmSourceIO.c

    r13192 r13347  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.39 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2007-05-03 20:04:31 $
     5 *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2007-05-11 03:44:16 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1717#include <math.h>
    1818#include <string.h>
    19 #include <strings.h>            /* for strn?casecmp */
     19#include <strings.h>            /* for strn?casecmp */
    2020#include <pslib.h>
    2121
     
    7171{
    7272    if (type == 4) {
    73         source->mode |= PM_SOURCE_MODE_FAIL;
     73        source->mode |= PM_SOURCE_MODE_FAIL;
    7474    }
    7575    if (type == 7) {
    76         source->mode |= PM_SOURCE_MODE_POOR;
     76        source->mode |= PM_SOURCE_MODE_POOR;
    7777    }
    7878    if (type == 10) {
    79         source->mode |= PM_SOURCE_MODE_SATSTAR;
     79        source->mode |= PM_SOURCE_MODE_SATSTAR;
    8080    }
    8181
     
    8585      case 7:
    8686      case 10:
    87         source->type = PM_SOURCE_TYPE_STAR;
    88         return true;
     87        source->type = PM_SOURCE_TYPE_STAR;
     88        return true;
    8989      case 2:
    90         source->type = PM_SOURCE_TYPE_EXTENDED;
    91         return true;
     90        source->type = PM_SOURCE_TYPE_EXTENDED;
     91        return true;
    9292      case 8:
    93         source->type = PM_SOURCE_TYPE_DEFECT;
    94         return true;
     93        source->type = PM_SOURCE_TYPE_DEFECT;
     94        return true;
    9595      default:
    96         return false;
     96        return false;
    9797    }
    9898    return false;
     
    209209    bool status;
    210210    char *exttype;
    211     char *realname;
    212     char *filename;
    213211    char *dataname;
    214212    char *headname;
     
    223221        return true;
    224222
    225     bool create = file->mode == PM_FPA_MODE_WRITE ? true : false;
    226 
    227223    switch (file->type) {
    228224      case PM_FPA_FILE_RAW:
    229         filename = pmFPAfileNameFromRule (file->filerule, file, view);
    230         realname = pmConfigConvertFilename (filename, config, create);
    231         pmSourcesWriteRAW (sources, realname);
    232         psFree (realname);
    233         psFree (filename);
     225        pmSourcesWriteRAW (sources, file->filename);
    234226        break;
    235227
    236228      case PM_FPA_FILE_OBJ:
    237         filename = pmFPAfileNameFromRule (file->filerule, file, view);
    238         realname = pmConfigConvertFilename (filename, config, create);
    239         pmSourcesWriteOBJ (sources, realname);
    240         psFree (realname);
    241         psFree (filename);
     229        pmSourcesWriteOBJ (sources, file->filename);
    242230        break;
    243231
    244232      case PM_FPA_FILE_SX:
    245         filename = pmFPAfileNameFromRule (file->filerule, file, view);
    246         realname = pmConfigConvertFilename (filename, config, create);
    247         pmSourcesWriteSX (sources, realname);
    248         psFree (realname);
    249         psFree (filename);
     233        pmSourcesWriteSX (sources, file->filename);
    250234        break;
    251235
     
    253237        // a SPLIT format : only one header and object table per file
    254238        hdu = pmFPAviewThisHDU (view, file->fpa);
    255         filename = pmFPAfileNameFromRule (file->filerule, file, view);
    256         realname = pmConfigConvertFilename (filename, config, create);
    257239
    258240        // copy the header to an output header, add the output header data
     
    271253        }
    272254
    273         bool status = pmSourcesWriteCMP (sources, realname, outhead);
     255        bool status = pmSourcesWriteCMP (sources, file->filename, outhead);
    274256        psFree (outhead);
    275         psFree (realname);
    276         psFree (filename);
    277257
    278258        if (!status) {
     
    355335        // this header block is new, write it to disk
    356336        if (hdu->header != file->header) {
    357             // XXX I was building a new copy, why?  supplement the output header
     337            // XXX I was building a new copy, why?  supplement the output header
    358338            // outhead = psMetadataCopy (NULL, hdu->header);
    359339
     
    547527        // read in header, if not yet loaded
    548528        hdu = pmFPAviewThisHDU (view, file->fpa);
     529#if 0
    549530        if (file->filename)
    550531            psFree (file->filename);
    551532        file->filename = pmFPAfileNameFromRule (file->filerule, file, view);
     533#endif
    552534
    553535        // indirect filenames
     
    562544        }
    563545
    564         bool create = file->mode == PM_FPA_MODE_WRITE ? true : false;
    565         psString realname = pmConfigConvertFilename (file->filename, config, create);
    566 
    567546        // read the PHU from this file
    568         file->fits = psFitsOpen (realname, "r");
     547        file->fits = psFitsOpen (file->filename, "r");
    569548        if (hdu->header != NULL) {
    570549            psFree (hdu->header);
     
    574553        file->fits = NULL;
    575554
    576         sources = pmSourcesReadCMP (realname, hdu->header);
    577         psFree (realname);
     555        sources = pmSourcesReadCMP (file->filename, hdu->header);
    578556        break;
    579557
     
    667645
    668646    if (view->chip == -1) {
    669         bool exists = pmFPACheckDataStatusForSources (fpa);
     647        bool exists = pmFPACheckDataStatusForSources (fpa);
    670648        return exists;
    671649    }
    672650    if (view->chip >= fpa->chips->n) {
    673         psError(PS_ERR_IO, true, "Requested chip == %d >= fpa->chips->n == %ld", view->chip, fpa->chips->n);
     651        psError(PS_ERR_IO, true, "Requested chip == %d >= fpa->chips->n == %ld", view->chip, fpa->chips->n);
    674652        return false;
    675653    }
     
    681659    }
    682660    if (view->cell >= chip->cells->n) {
    683         psError(PS_ERR_IO, true, "Requested cell == %d >= chip->cells->n == %ld", view->cell, chip->cells->n);
     661        psError(PS_ERR_IO, true, "Requested cell == %d >= chip->cells->n == %ld", view->cell, chip->cells->n);
    684662        return false;
    685663    }
     
    692670
    693671    if (view->readout >= cell->readouts->n) {
    694         psError(PS_ERR_IO, true, "Requested readout == %d >= cell->readouds->n == %ld", view->readout, cell->readouts->n);
     672        psError(PS_ERR_IO, true, "Requested readout == %d >= cell->readouds->n == %ld", view->readout, cell->readouts->n);
    695673        return false;
    696674    }
     
    704682
    705683    for (int i = 0; i < fpa->chips->n; i++) {
    706         pmChip *chip = fpa->chips->data[i];
    707         if (!chip) continue;
    708         if (pmChipCheckDataStatusForSources (chip)) return true;
     684        pmChip *chip = fpa->chips->data[i];
     685        if (!chip) continue;
     686        if (pmChipCheckDataStatusForSources (chip)) return true;
    709687    }
    710688    return false;
     
    714692
    715693    for (int i = 0; i < chip->cells->n; i++) {
    716         pmCell *cell = chip->cells->data[i];
    717         if (!cell) continue;
    718         if (pmCellCheckDataStatusForSources (cell)) return true;
     694        pmCell *cell = chip->cells->data[i];
     695        if (!cell) continue;
     696        if (pmCellCheckDataStatusForSources (cell)) return true;
    719697    }
    720698    return false;
     
    724702
    725703    for (int i = 0; i < cell->readouts->n; i++) {
    726         pmReadout *readout = cell->readouts->data[i];
    727         if (!readout) continue;
    728         if (pmReadoutCheckDataStatusForSources (readout)) return true;
     704        pmReadout *readout = cell->readouts->data[i];
     705        if (!readout) continue;
     706        if (pmReadoutCheckDataStatusForSources (readout)) return true;
    729707    }
    730708    return false;
Note: See TracChangeset for help on using the changeset viewer.