Ignore:
Timestamp:
08/21/13 16:35:22 (11 years ago)
Author:
lyard
Message:
Added error when using wrong fits class and adapted MRawFitsRead to deal with compressed .fz fits
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/mcore/zfits.h

    r16898 r17035  
    3737
    3838    // Basic constructor
    39     zfits(const string& fname, const string& tableName="",
    40           bool force=false) : fits(fname, tableName, force),
    41         fNumTiles(0),
    42         fNumRowsPerTile(0),
    43         fCurrentRow(-1),
    44         fHeapOff(0),
    45         fTileSize(0)
    46     {
     39    zfits(const string& fname, const string& tableName="", bool force=false) : fits(),
     40                                                                               fNumTiles(0),
     41                                                                               fNumRowsPerTile(0),
     42                                                                               fCurrentRow(-1),
     43                                                                               fHeapOff(0),
     44                                                                               fTileSize(0)
     45    {
     46        open(fname.c_str());
     47        Constructor(fname, "", tableName, force);
    4748        InitCompressionReading();
    4849    }
    4950
    5051    // Alternative contstructor
    51     zfits(const string& fname, const string& fout, const string& tableName,
    52           bool force=false) : fits(fname, fout, tableName, force),
    53               fNumTiles(0),
    54               fNumRowsPerTile(0),
    55               fCurrentRow(-1),
    56               fHeapOff(0),
    57               fTileSize(0)
    58     {
     52    zfits(const string& fname, const string& fout, const string& tableName, bool force=false) : fits(),
     53                                                                                                fNumTiles(0),
     54                                                                                                fNumRowsPerTile(0),
     55                                                                                                fCurrentRow(-1),
     56                                                                                                fHeapOff(0),
     57                                                                                                fTileSize(0)
     58    {
     59        open(fname.c_str());
     60        Constructor(fname, fout, tableName, force);
    5961        InitCompressionReading();
    6062    }
     
    8385        return fits::IsFileOk() && rawsum;
    8486    };
     87
     88    size_t GetNumRows() const
     89    {
     90        if (fTable.is_compressed)
     91            return fTable.Get<size_t>("ZNAXIS2");
     92        else
     93            return fTable.Get<size_t>("NAXIS2");
     94    }
     95    size_t GetBytesPerRow() const
     96    {
     97        if (fTable.is_compressed)
     98            return fTable.Get<size_t>("ZNAXIS1");
     99        else
     100            return fTable.Get<size_t>("NAXIS1");
     101    }
    85102
    86103protected:
Note: See TracChangeset for help on using the changeset viewer.