IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 2855


Ignore:
Timestamp:
Dec 30, 2004, 10:18:37 AM (22 years ago)
Author:
desonia
Message:

Updated psChip/psCell to current SDRS spec.

Location:
trunk/psLib
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/psLib.kdevelop.filelist

    r2837 r2855  
    11# KDevelop Custom Project File List
    2 tags
    3 test/collections/psArray_02.c
    4 
  • trunk/psLib/psLib.kdevses

    r2837 r2855  
    22<!DOCTYPE KDevPrjSession>
    33<KDevPrjSession>
    4  <DocsAndViews NumberOfDocuments="0" />
     4 <DocsAndViews NumberOfDocuments="3" >
     5  <Doc0 NumberOfViews="1" URL="file:/home/desonia/psLib/src/astronomy/psAstrometry.c" >
     6   <View0 Type="Source" />
     7  </Doc0>
     8  <Doc1 NumberOfViews="1" URL="file:/home/desonia/psLib/test/astronomy/tst_psAstrometry.c" >
     9   <View0 Type="Source" />
     10  </Doc1>
     11  <Doc2 NumberOfViews="1" URL="file:/home/desonia/psLib/src/collections/psArray.c" >
     12   <View0 line="91" Type="Source" />
     13  </Doc2>
     14 </DocsAndViews>
    515 <pluginList>
    616  <kdevbookmarks>
     
    1121   </bookmarks>
    1222  </kdevbookmarks>
     23  <kdevsubversion>
     24   <subversion recurseresolve="1" recurserelocate="1" recursemerge="1" recursecommit="1" base="" recursepropget="1" recurseswitch="1" recurseupdate="1" recursepropset="1" recursediff="1" recurserevert="1" forcemove="1" recursecheckout="1" forceremove="1" recurseadd="1" recurseproplist="1" forcemerge="1" />
     25  </kdevsubversion>
    1326  <kdevvalgrind>
    1427   <executable path="" params="" />
  • trunk/psLib/src/astronomy/psAstrometry.c

    r2600 r2855  
    88 *  @author GLG, MHPCC
    99 *
    10  *  @version $Revision: 1.52 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2004-12-02 21:12:51 $
     10 *  @version $Revision: 1.53 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-12-30 20:18:36 $
    1212 *
    1313 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    399399
    400400    // create array of NULL psCells
    401     chip->cells = psArrayAlloc(nCells);
     401    int n = (nCells > 0) ? nCells : 1;
     402    chip->cells = psArrayAlloc(n);
    402403    psPtr* cells = chip->cells->data;
    403     for (psS32 i=0;i<nCells;i++) {
     404    for (psS32 i=0;i<n;i++) {
    404405        cells[i] = NULL;
    405406    }
     407    chip->cells->n = 0; // per requirement
     408
     409    *(int*)&chip->row0 = 0;
     410    *(int*)&chip->col0 = 0;
    406411
    407412    chip->metadata = NULL;
     
    429434
    430435    // create array of NULL psReadouts
    431     cell->readouts = psArrayAlloc(nReadouts);
     436    int n = (nReadouts > 0) ? nReadouts : 1;
     437    cell->readouts = psArrayAlloc(n);
    432438    psPtr* readouts = cell->readouts->data;
    433     for (psS32 i=0;i<nReadouts;i++) {
     439    for (psS32 i=0;i<n;i++) {
    434440        readouts[i] = NULL;
    435441    }
     442    cell->readouts->n = 0; // per requirement
     443
     444    *(int*)&cell->row0 = 0;
     445    *(int*)&cell->col0 = 0;
    436446
    437447    cell->metadata = NULL;
     
    452462}
    453463
    454 psReadout* psReadoutAlloc(psS32 col0,
    455                           psS32 row0,
    456                           const psImage* image)
    457 {
    458     PS_INT_CHECK_NON_NEGATIVE(col0, NULL);
    459     PS_INT_CHECK_NON_NEGATIVE(row0, NULL);
    460 
     464psReadout* psReadoutAlloc()
     465{
    461466    psReadout* readout = psAlloc(sizeof(psReadout));
    462467
    463     *(psU32*)&readout->colBins = 1;
    464     *(psU32*)&readout->rowBins = 1;
    465     *(psS32*)&readout->col0 = col0;
    466     *(psS32*)&readout->row0 = row0;
    467 
    468     readout->image = (psImage*)image;
     468    *(psU32*)&readout->colBins = 0;
     469    *(psU32*)&readout->rowBins = 0;
     470    *(psU32*)&readout->rowParity = 0;
     471    *(psU32*)&readout->colParity = 0;
     472    *(psS32*)&readout->col0 = 0;
     473    *(psS32*)&readout->row0 = 0;
     474
     475    readout->image = NULL;
    469476    readout->mask = NULL;
    470477    readout->objects = NULL;
     
    718725    PS_PTR_CHECK_NULL(cellCoord, NULL);
    719726    PS_PTR_CHECK_NULL(cell, NULL);
    720     PS_PTR_CHECK_NULL(cell->toTP, NULL);
     727    PS_PTR_CHECK_NULL(cell->toSky, NULL);
    721728    PS_PTR_CHECK_NULL(cell->parent, NULL);
    722729    PS_PTR_CHECK_NULL(cell->parent->parent, NULL);
  • trunk/psLib/src/astronomy/psAstrometry.h

    r2600 r2855  
    88*  @author GLG, MHPCC
    99*
    10 *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
    11 *  @date $Date: 2004-12-02 21:12:51 $
     10*  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
     11*  @date $Date: 2004-12-30 20:18:36 $
    1212*
    1313*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    9999typedef struct
    100100{
    101     const psU32 colBins;        ///< Amount of binning in x-dimension
    102     const psU32 rowBins;        ///< Amount of binning in y-dimension
    103     const psS32 col0;                    ///< Offset from the left of chip.
    104     const psS32 row0;                    ///< Offset from the bottom of chip.
     101    const psS32 col0;                  ///< Offset from the left of chip.
     102    const psS32 row0;                  ///< Offset from the bottom of chip.
     103
     104    const int colParity;               ///< Column Readout Direction
     105    const int rowParity;               ///< Row Readout Direction
     106
     107    const psU32 colBins;               ///< Amount of binning in x-dimension
     108    const psU32 rowBins;               ///< Amount of binning in y-dimension
    105109
    106110    psImage* image;                    ///< Imaging area of readout
     
    122126typedef struct
    123127{
     128    const psS32 col0;                  ///< Offset from the left of chip
     129    const psS32 row0;                  ///< Offset from the bottom of chip
     130
    124131    psArray* readouts;                 ///< readouts from the cell
     132
    125133    psMetadata* metadata;              ///< cell-level metadata
    126134
    127135    psPlaneTransform* toChip;          ///< transformations from cell to chip coordinates
    128     psPlaneTransform* fromChip;        ///< transformations from chip to cell coordinates
     136    psPlaneTransform* fromChip;        ///< transformations from cell to chip coordinates
    129137    psPlaneTransform* toFPA;           ///< transformations from cell to FPA coordinates
    130     psPlaneTransform* toTP;            ///< transformations from cell to tangent plane coordinates
    131     psPlaneTransform* toSky;            ///< transformations from cell to tangent plane coordinates
     138    psPlaneTransform* toTP;            ///< transformations from cell to FPA coordinates
     139    psPlaneTransform* toSky;           ///< transformations from cell to tangent plane coordinates
    132140
    133141    struct psChip* parent;             ///< chip in which contains this cell
     
    145153typedef struct psChip
    146154{
     155    const psS32 col0;                  ///< Offset from the left of FPA
     156    const psS32 row0;                  ///< Offset from the bottom of FPA
     157
    147158    psArray* cells;                    ///< cells in the chip
     159
    148160    psMetadata* metadata;              ///< chip-level metadata
    149161
     
    282294/** Allocator for psObservatory
    283295 *
    284  *  This function shall construct a new psObservatory with attributes 
     296 *  This function shall construct a new psObservatory with attributes
    285297 *  cooresponding to the function parameters.
    286298 *
     
    340352 *  to NULL.
    341353 *
    342  *  @return psReadout*    newly allocated psReadout
    343  */
    344 psReadout* psReadoutAlloc(
    345     psS32 col0,                          ///< offset from the left of the cell
    346     psS32 row0,                          ///< offset from the bottom of the cell
    347     const psImage* image               ///< image of the readout
    348 );
     354 *  @return psReadout*    newly allocated psReadout with all internal pointers set to NULL
     355 */
     356psReadout* psReadoutAlloc();
    349357
    350358/** Allocates a Wallace's Grommit structure.
  • trunk/psLib/src/collections/psArray.c

    r2836 r2855  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-12-28 01:48:05 $
     11 *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-12-30 20:18:36 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    114114    psBool success = false;
    115115
     116    if (psArr == NULL) {
     117        psError(PS_ERR_BAD_PARAMETER_NULL, true,
     118                PS_ERRORTEXT_psArray_ARRAY_NULL);
     119        return false;
     120    }
    116121
    117122    psS32 n = psArr->n;
  • trunk/psLib/src/collections/psCollectionsErrors.dat

    r2681 r2855  
    99#
    1010psArray_REALLOC_NULL                   psArrayRealloc must be given a non-NULL psArray to resize.
     11psArray_ARRAY_NULL                     Specified psArray can not be NULL.
    1112#
    1213psVector_REALLOC_NULL                  psVectorRealloc must a given a non-NULL psVector to resize.  Desired datatype unknown.
     
    3637psList_ITERATOR_INVALID                Specified iterator is not valid.
    3738psList_ITERATOR_NULL                   Specified iterator is NULL.
    38 psList_LIST_NULL                       Specified psList reference is NULL. 
     39psList_LIST_NULL                       Specified psList reference is NULL.
    3940psList_DATA_NULL                       Specified data item is NULL.
    4041psList_DATA_NOT_FOUND                  Specified data item is not found in the psList.
  • trunk/psLib/src/collections/psCollectionsErrors.h

    r2681 r2855  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-12-10 02:50:14 $
     9 *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-12-30 20:18:36 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3131//~Start #define PS_ERRORTEXT_$1 "$2"
    3232#define PS_ERRORTEXT_psArray_REALLOC_NULL "psArrayRealloc must be given a non-NULL psArray to resize."
     33#define PS_ERRORTEXT_psArray_ARRAY_NULL "Specified psArray can not be NULL."
    3334#define PS_ERRORTEXT_psVector_REALLOC_NULL "psVectorRealloc must a given a non-NULL psVector to resize.  Desired datatype unknown."
    3435#define PS_ERRORTEXT_psVector_NOT_A_VECTOR "The input psVector must have a vector dimension type."
     
    5354#define PS_ERRORTEXT_psList_ITERATOR_INVALID "Specified iterator is not valid."
    5455#define PS_ERRORTEXT_psList_ITERATOR_NULL "Specified iterator is NULL."
    55 #define PS_ERRORTEXT_psList_LIST_NULL "Specified psList reference is NULL. "
     56#define PS_ERRORTEXT_psList_LIST_NULL "Specified psList reference is NULL."
    5657#define PS_ERRORTEXT_psList_DATA_NULL "Specified data item is NULL."
    5758#define PS_ERRORTEXT_psList_DATA_NOT_FOUND "Specified data item is not found in the psList."
  • trunk/psLib/src/types/psArray.c

    r2836 r2855  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-12-28 01:48:05 $
     11 *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-12-30 20:18:36 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    114114    psBool success = false;
    115115
     116    if (psArr == NULL) {
     117        psError(PS_ERR_BAD_PARAMETER_NULL, true,
     118                PS_ERRORTEXT_psArray_ARRAY_NULL);
     119        return false;
     120    }
    116121
    117122    psS32 n = psArr->n;
  • trunk/psLib/test/astronomy/tst_psAstrometry.c

    r2536 r2855  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-11-30 21:47:19 $
     7 *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-12-30 20:18:36 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    278278
    279279    /*
    280         2. Call psFPAAlloc with nChips = 0. Verify that the chips array is 
     280        2. Call psFPAAlloc with nChips = 0. Verify that the chips array is
    281281           zero in size and the program execution does not stop.
    282282    */
     
    291291
    292292    /*
    293         3. Call psFPAAlloc with a NULL psExposure. Verify that the program 
     293        3. Call psFPAAlloc with a NULL psExposure. Verify that the program
    294294           execution doe not stop and the exposure attribute is NULL.
    295295    */
     
    303303
    304304    /*
    305         4. Call psFPAAlloc and set all references in the struct to a memory 
    306            buffer. Verify that psFree cleans up all the buffers referenced in 
     305        4. Call psFPAAlloc and set all references in the struct to a memory
     306           buffer. Verify that psFree cleans up all the buffers referenced in
    307307           the struct, i.e., there is no memory leaks generated.
    308308    */
     
    353353
    354354    /*
    355         1. invoke psChipAlloc with nCells > 0 and parentFPA non-NULL. Verify 
     355        1. invoke psChipAlloc with nCells > 0 and parentFPA non-NULL. Verify
    356356           that:
    357357        a. the cells array is of the size nCells and all elements are NULL.
    358         b. parent attribute is set to parentFPA parameter and the ref. count 
     358        b. parent attribute is set to parentFPA parameter and the ref. count
    359359           was incremented.
    360360        c. all other attributes are initialized to NULL or 0.
     
    368368    }
    369369
    370     if (chip->cells->n != 8) {
     370    if (chip->cells->n != 0) {
    371371        psLogMsg(__func__,PS_LOG_ERROR,
    372372                 "psChipAlloc did not set the number of cells properly.");
     373        return 2;
     374    }
     375
     376    if (chip->cells->nalloc != 8) {
     377        psLogMsg(__func__,PS_LOG_ERROR,
     378                 "psChipAlloc did not allocate cell array size properly.");
    373379        return 2;
    374380    }
     
    382388        chip->cells->data[lcv] = psAlloc(4); // to check if these are freed.
    383389    }
     390    chip->cells->n = 8;
    384391
    385392    if (chip->parent != fpa) {
     
    419426        2. invoke psChipAlloc with nCells = 0. Verify that:
    420427        a. execution does not halt
    421         b. the cells array is of the size of zero.   
     428        b. the cells array is of the size of one.
    422429    */
    423430
     
    435442    }
    436443
     444    if (chip2->cells->nalloc != 1) {
     445        psLogMsg(__func__,PS_LOG_ERROR,
     446                 "psChipAlloc did not allocate cell array size properly.");
     447        return 12;
     448    }
     449
    437450    if (chip2->parent != fpa) {
    438451        psLogMsg(__func__,PS_LOG_ERROR,
     
    448461
    449462    /*
    450         3. invoke psChipAlloc with parentFPA = NULL. Verify that parent 
     463        3. invoke psChipAlloc with parentFPA = NULL. Verify that parent
    451464           attribute is NULL and no error is generated.
    452465    */
     
    459472    }
    460473
    461     if (chip3->cells->n != 8) {
     474    if (chip3->cells->n != 0) {
    462475        psLogMsg(__func__,PS_LOG_ERROR,
    463476                 "psChipAlloc did not set the number of cells properly.");
    464477        return 22;
     478    }
     479
     480    if (chip3->cells->nalloc != 8) {
     481        psLogMsg(__func__,PS_LOG_ERROR,
     482                 "psChipAlloc did not allocate cell array properly.");
     483        return 23;
    465484    }
    466485
     
    487506
    488507    psObservatory* obs = psObservatoryAlloc(name,
    489                                             20.7*M_PI/180.0, 156.3*M_PI/180.0, 3055.0, 0.0065f);
    490 
    491     psExposure* exp = psExposureAlloc(1.0, 2.0, 3.0, 4.0, 5.0,
    492                                       now, 6.0f, 260.0f, 1013.0f, 0.7f, 10.0f, 0.650f, obs);
     508                                            20.7*M_PI/180.0,
     509                                            156.3*M_PI/180.0,
     510                                            3055.0,
     511                                            0.0065f);
     512
     513    psExposure* exp = psExposureAlloc(1.0,
     514                                      2.0,
     515                                      3.0,
     516                                      4.0,
     517                                      5.0,
     518                                      now,
     519                                      6.0f,
     520                                      260.0f,
     521                                      1013.0f,
     522                                      0.7f,
     523                                      10.0f,
     524                                      0.650f,
     525                                      obs);
    493526
    494527    psFPA* fpa = psFPAAlloc(8, exp);
     
    507540        1. invoke psCellAlloc with nReadouts > 0 and parentChip non-NULL. Verify that:
    508541        a. the readouts array is of the size nReadouts and all elements are NULL.
    509         b. parent attribute is set to parentChip parameter and the ref. count 
     542        b. parent attribute is set to parentChip parameter and the ref. count
    510543           was incremented.
    511544        c. all other attributes are initialized to NULL or 0.
     
    519552    }
    520553
    521     if (cell1->readouts->n != 8) {
     554    if (cell1->readouts->n != 0) {
    522555        psLogMsg(__func__,PS_LOG_ERROR,
    523556                 "psCellAlloc did not set the number of readouts properly.");
     557        return 2;
     558    }
     559
     560    if (cell1->readouts->nalloc != 8) {
     561        psLogMsg(__func__,PS_LOG_ERROR,
     562                 "psCellAlloc did not allocat the readout array properly.");
    524563        return 2;
    525564    }
     
    533572        cell1->readouts->data[lcv] = psAlloc(4); // to check if these are freed.
    534573    }
     574    cell1->readouts->n = 8;
    535575
    536576    if (cell1->parent != chip) {
     
    584624        2. invoke psChipAlloc with nCells = 0. Verify that:
    585625        a. execution does not halt
    586         b. the cells array is of the size of zero.   
     626        b. the cells array is of the size of one.
    587627    */
    588628
     
    600640    }
    601641
     642    if (cell2->readouts->nalloc != 1) {
     643        psLogMsg(__func__,PS_LOG_ERROR,
     644                 "psCellAlloc did not allocate the readout array properly.");
     645        return 13;
     646    }
     647
    602648    if (cell2->parent != chip) {
    603649        psLogMsg(__func__,PS_LOG_ERROR,
     
    613659
    614660    /*
    615         3. invoke psChipAlloc with parentFPA = NULL. Verify that parent 
     661        3. invoke psChipAlloc with parentFPA = NULL. Verify that parent
    616662           attribute is NULL and no error is generated.
    617663    */
     
    624670    }
    625671
    626     if (cell3->readouts->n != 8) {
     672    if (cell3->readouts->n != 0) {
    627673        psLogMsg(__func__,PS_LOG_ERROR,
    628674                 "psCellAlloc did not set the number of cells properly.");
    629675        return 22;
     676    }
     677
     678    if (cell3->readouts->nalloc != 8) {
     679        psLogMsg(__func__,PS_LOG_ERROR,
     680                 "psCellAlloc did not set the number of cells properly.");
     681        return 23;
    630682    }
    631683
     
    647699static psS32 testReadoutAlloc(void)
    648700{
    649     psImage* image = psImageAlloc(64,64,PS_TYPE_S8);
    650 
    651 
    652     /*
    653         1. invoke psReadoutAlloc with unique/non-zero x0,y0 and non-NULL image. Verify that:
    654         a. col0 & row0 are set to the parameters x0 and y0, respectively.
    655         b. image attribute is set to image parameter and referenece is incremented
    656         c. mask, objects, and metadata attributes are all NULL
    657     */
    658     psReadout* readout = psReadoutAlloc(1,2,image);
     701    psReadout* readout = psReadoutAlloc();
    659702
    660703    if (readout == NULL) {
     
    663706    }
    664707
    665     if (readout->col0 != 1) {
     708    if (readout->col0 != 0) {
    666709        psLogMsg(__func__,PS_LOG_ERROR,
    667710                 "psReadoutAlloc did not set col0 properly.");
     
    669712    }
    670713
    671     if (readout->row0 != 2) {
     714    if (readout->row0 != 0) {
    672715        psLogMsg(__func__,PS_LOG_ERROR,
    673716                 "psReadoutAlloc did not set row0 properly.");
     
    675718    }
    676719
    677     if (readout->image != image) {
     720    if (readout->image != NULL) {
    678721        psLogMsg(__func__,PS_LOG_ERROR,
    679722                 "psReadoutAlloc did not set the image properly.");
     
    681724    }
    682725
    683     if (psMemGetRefCounter(image) != 1) {
    684         psLogMsg(__func__,PS_LOG_ERROR,
    685                  "psReadoutAlloc incremented reference counter for image.");
    686         return 5;
    687     }
     726    readout->image = psAlloc(4); // to check if these are freed.
    688727
    689728    if (readout->metadata != NULL) {
  • trunk/psLib/test/collections/verified/tst_psArray.stderr

    r2354 r2855  
    33<DATE><TIME>|<HOST>|E|psArrayRealloc (psArray.c:<LINENO>)
    44    psArrayRealloc must be given a non-NULL psArray to resize.
     5<DATE><TIME>|<HOST>|E|psArrayRemove (psArray.c:<LINENO>)
     6    Specified psArray can not be NULL.
  • trunk/psLib/test/image/tst_psImageManip.c

    r2835 r2855  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-12-28 01:43:17 $
     8 *  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-12-30 20:18:37 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Note: See TracChangeset for help on using the changeset viewer.