IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 36884


Ignore:
Timestamp:
Jun 17, 2014, 5:58:38 AM (12 years ago)
Author:
eugene
Message:

merge in changes from trunk (up through pv3 tag)

Location:
branches/eam_branches/ipp-20140610
Files:
141 edited
14 copied

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20140610

  • branches/eam_branches/ipp-20140610/Ohana/src/getstar

  • branches/eam_branches/ipp-20140610/Ohana/src/getstar/src/ReadImageFiles.c

    r34088 r36884  
    138138          !strcmp (tmpword, "PS1_V1") || 
    139139          !strcmp (tmpword, "PS1_V2") || 
    140           !strcmp (tmpword, "PS1_V3")) {
     140          !strcmp (tmpword, "PS1_V3") || 
     141          !strcmp (tmpword, "PS1_V4") || 
     142          !strcmp (tmpword, "PS1_V5")) {
    141143
    142144          exttype[Nimage] = strcreate (tmpword);
  • branches/eam_branches/ipp-20140610/Ohana/src/relastro/src/launch_region_hosts.c

    r36833 r36884  
    99  for (i = 0; i < regionHosts->Nhosts; i++) {
    1010    char *syncfile = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "meanmags.sync");
    11     truncate (syncfile, 0);
     11    if (truncate (syncfile, 0)) fprintf (stderr, "trouble clearing syncfile %s\n", syncfile);
    1212    free (syncfile);
    1313
    1414    char *fitsfile = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "meanmags.fits");
    15     truncate (fitsfile, 0);
     15    if (truncate (fitsfile, 0)) fprintf (stderr, "trouble clearing fitsfile %s\n", fitsfile);
    1616    free (fitsfile);
    1717
    1818    char *imsyncfile = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "imagemags.sync");
    19     truncate (imsyncfile, 0);
     19    if (truncate (imsyncfile, 0)) fprintf (stderr, "trouble clearing imsyncfile %s\n", imsyncfile);
    2020    free (imsyncfile);
    2121
    2222    char *imfitsfile = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "imagemags.fits");
    23     truncate (imfitsfile, 0);
     23    if (truncate (imfitsfile, 0)) fprintf (stderr, "trouble clearing imfitsfile %s\n", imfitsfile);
    2424    free (imfitsfile);
    2525
    2626    char *loopsyncfile = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "loop.sync");
    27     truncate (loopsyncfile, 0);
     27    if (truncate (loopsyncfile, 0)) fprintf (stderr, "trouble clearing loopsyncfile %s\n", loopsyncfile);
    2828    free (loopsyncfile);
    2929  }
  • branches/eam_branches/ipp-20140610/Ohana/src/relastro/src/syncfile.c

    r36630 r36884  
    5050int clear_sync_file (char *filename) {
    5151  // delete file contents
    52   truncate (filename, 0);
     52  if (truncate (filename, 0)) fprintf (stderr, "trouble clearing file %s\n", filename);
    5353
    5454  return TRUE;
  • branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/launch_region_hosts.c

    r36630 r36884  
    2222  for (i = 0; i < regionHosts->Nhosts; i++) {
    2323    char *syncfile = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "meanmags.sync");
    24     truncate (syncfile, 0);
     24    if (truncate (syncfile, 0)) fprintf (stderr, "trouble clearing syncfile %s\n", syncfile);
    2525    free (syncfile);
    2626
    2727    char *fitsfile = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "meanmags.fits");
    28     truncate (fitsfile, 0);
     28    if (truncate (fitsfile, 0)) fprintf (stderr, "trouble clearing fitsfile %s\n", fitsfile );
    2929    free (fitsfile);
    3030
    3131    char *imsyncfile = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "imagemags.sync");
    32     truncate (imsyncfile, 0);
     32    if (truncate (imsyncfile, 0)) fprintf (stderr, "trouble clearing imsyncfile %s\n", imsyncfile);
    3333    free (imsyncfile);
    3434
    3535    char *imfitsfile = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "imagemags.fits");
    36     truncate (imfitsfile, 0);
     36    if (truncate (imfitsfile, 0)) fprintf (stderr, "trouble clearing imfitsfile %s\n", imfitsfile);
    3737    free (imfitsfile);
    3838
    3939    char *loopsyncfile = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "loop.sync");
    40     truncate (loopsyncfile, 0);
     40    if (truncate (loopsyncfile, 0)) fprintf (stderr, "trouble clearing loopsyncfile %s\n", loopsyncfile);
    4141    free (loopsyncfile);
    4242  }
  • branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/syncfile.c

    r36630 r36884  
    5050int clear_sync_file (char *filename) {
    5151  // delete file contents
    52   truncate (filename, 0);
     52  if (truncate (filename, 0)) fprintf (stderr, "trouble clearing file %s\n", filename);
    5353
    5454  return TRUE;
  • branches/eam_branches/ipp-20140610/ippScripts/scripts/queuestaticsky.pl

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20140610/ippScripts/scripts/sc_prepare_camera.pl

    r36844 r36884  
    179179    $psastro_command   .= " -masklist ${remote_outroot}.masklist ${remote_outroot} ";
    180180#    $psastro_command   .= " -refmasklist ${remote_outroot}.masklist ${remote_outroot} "; # This is used to do edge calculations.  It should probably be smart enough to know that it can just use the masks I just specified, but it's not.
     181    # Uncomment when remote psastro supports this
     182    $psastro_command   .= " -kh-correct /turquoise/usr/projects/ps1/watersc1/references/khcorrect.20140606.v0.fits ";
    181183    $psastro_command   .= " -refmasklist /turquoise/usr/projects/ps1/watersc1/references/gpc1.refmask.list ";
    182     $psastro_command   .= " -astrommodel /turquoise/usr/projects/ps1/watersc1/references/gpc1.20080909.asm ";
     184#    $psastro_command   .= " -astrommodel /turquoise/usr/projects/ps1/watersc1/references/gpc1.20080909.asm ";
     185    $psastro_command   .= " -astrommodel /turquoise/usr/projects/ps1/watersc1/references/gpc1.20140505.asm ";
    183186    $psastro_command   .= " -recipe PSASTRO $recipe_psastro ";
    184187    $psastro_command   .= " -tracedest ${remote_outroot}.trace -log ${remote_outroot}.log ";
  • branches/eam_branches/ipp-20140610/ippScripts/scripts/sc_prepare_chip.pl

    r36844 r36884  
    315315        $ppImage_command .= " -recipe PSPHOT $recipe_psphot ";
    316316        $ppImage_command .= " -recipe PPSTATS CHIPSTATS -stats ${remote_outroot}.${class_id}.stats ";
    317         $ppImage_command .= " -threads $threads ";
     317        $ppImage_command .= " -threads 4 ";
    318318        $ppImage_command .= " -image_id $chip_imfile_id ";
    319319        $ppImage_command .= " -tracedest ${remote_outroot}.${class_id}.trace ";
  • branches/eam_branches/ipp-20140610/ippScripts/scripts/sc_prepare_warp.pl

    r36844 r36884  
    199199        $pswarp_command    .= " -recipe PSWARP $recipe_pswarp ";
    200200        $pswarp_command    .= " -tracedest ${remote_outroot}.trace -log ${remote_outroot}.log ";
    201         $pswarp_command    .= " -threads $threads "; # -image_id ${image_id} -source_id ${source_id} ";
     201        $pswarp_command    .= " -threads 4 "; # -image_id ${image_id} -source_id ${source_id} ";
    202202        $pswarp_command    .= " -recipe PPSTATS WARPSTATS ";
    203203        $pswarp_command    .= " -dumpconfig ${remote_outroot}.mdc -stats ${remote_outroot}.stats ";
  • branches/eam_branches/ipp-20140610/ippTasks/Makefile.am

    r36452 r36884  
    4949        vp.pro \
    5050        bg.regeneration.pro \
     51        remote.pro \
    5152        fullforce.pro
    5253
  • branches/eam_branches/ipp-20140610/ippToPsps/pspsschema/SchemaNew16.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/Detection

    r36815 r36884  
    88imageID         dimensionless   BIGINT  8         NA    image id hash of frame identifier & OTA/CCD number
    99randomDetID     dimensionless   BIGINT  8         NA    random detection Id
    10 dvoRegionID     dimensionless   REAL    4       -999    identifier to dvo spatial region
     10dvoRegionID     dimensionless   INT     4          0    identifier to dvo spatial region
    1111obsTime         MeanJulianDays  FLOAT   8       -999    Time of mid observation in Mean Julian Days
    1212xPos            raw pixels      REAL    4       -999    measured x on CCD from PSF fit
     
    4040momentYY        arcsec^2        REAL    4       -999    momeny YY
    4141momentR1        arcsec          REAL    4       -999    first radial moment
    42 momentRH        arcsec          REAL    4       -999    half light radius
     42momentRH        arcsec          REAL    4       -999    half light radius (REMOVE THIS)
    4343momentM3C       arcsec^n        REAL    4       -999    3rd moment sin(theta)
    4444momentM3S       arcsec^n        REAL    4       -999    3rd moment cos(theta)
     
    5151kronFluxErr     adu/seconds     REAL    4       -999    Kron flux error
    5252kronRad         arcsec          REAL    4       -999    Kron radius
    53 kronRadErr      arcsec          REAL    4       -999    Kron radius error
     53kronRadErr      arcsec          REAL    4       -999    Kron radius error (DROP)
    5454sky             adu/sec/pixel   REAL    4       -999    PSF sky level at source
    5555skyErr          adu/sec/pixel   REAL    4       -999    estimated error in sky
    56 infoFlag        dimensionless   BIGINT  8       -999    flag indicating provenance information
     56infoFlag        dimensionless   INT     4       -999    flag indicating provenance information
     57infoFlag2       dimensionless   INT     4       -999    flag indicating provenance information
    5758dataRelease     dimensionless   TINYINT 1         NA    Data release when this detection was originally taken. Recalibrations do not affect this value.
    5859--
  • branches/eam_branches/ipp-20140610/ippToPsps/pspsschema/SchemaNew16.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/DiffDetObject

    r36815 r36884  
    22diffObjName     string          VAR     8       NA      IAU Name constructed from objID postion PS1.x JHHMMSS.SS+/-DDMMSS.S x procesing version       
    33diffObjID       dimensionless   BIGINT  8       NA      ODM object identifier index
    4 diffgcObjID             dimensionless   BIGINT  8         NA    ODM galactic coordinates identifier
     4diffgcObjID     dimensionless   BIGINT  8       NA      ODM galactic coordinates identifier
    55ippObjID        dimensionless   BIGINT  8       NA      IPP object number
    66surveyID        dimensionless   TINYINT 1       255     Survey ID
     
    1010randomID        dimensionless   BIGINT  8       0       Random integer between 0 and 2^32 = 4,394,967,296 remaining ramdom integer 0 
    1111batchID         dimensionless   BIGINT  8       -999   
    12 dvoRegionID     dimensionless   REAL    4       -999    identifier to dvo spatial region
     12dvoRegionID     dimensionless   INT     4       -999    identifier to dvo spatial region
    1313objInfoFlag     dimensionless   BIGINT  8       -999    flag indicating odd properties
    1414qualityFlag     dimensionless   TINYINT 1       0       subset of objInfoFlag - flags related to goodness of object
    15 consistencyFlag dimensionless   SMALLINT2       0       Value computed from associated detections, it is originally given by IPP and should agree with the ODM validation
     15consistencyFlag dimensionless   SMALLINT2       0       Value computed from associated detections, it is originally given by IPP and should agree with the ODM validation (DROP)
    1616ra              degrees         FLOAT   8       NA      Right Ascension
    1717dec             degrees         FLOAT   8       NA      Declination
  • branches/eam_branches/ipp-20140610/ippToPsps/pspsschema/SchemaNew16.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/DiffDetection

    r36815 r36884  
     1
    12diffObjID       dimensionless   BIGINT  8       NA      diff object identifier
    2 diffgcObjID             dimensionless   BIGINT  8         NA    ODM galactic coordinates identifier
     3diffgcObjID     dimensionless   BIGINT  8       NA      ODM galactic coordinates identifier
    34diffDetID       dimensionless   BIGINT  8       NA      diff detection identifier
    45diffDetMetaID   dimensionless   BIGINT  8       NA      diff detection meta identifier
     
    910randomDiffID    dimensionless   BIGINT  8       NA      random diff id 
    1011skyCellID       dimensionless   REAL    4       -999    single float giving PrimaryCell.SkyCell identifier
    11 dvoRegionID     dimensionless   REAL    4       -999    identifier to dvo spatial region
     12dvoRegionID     dimensionless   INT     4          0    identifier to dvo spatial region
    1213obsTime         MeanJulianDays  FLOAT   8       -999    Time of mid observation of positive detection in Mean Julian Days of positive detection
    1314xPos            pixels          REAL    4       -999    measured x on diff image sky cell PSF fit
     
    4142momentYY        arcsec^2        REAL    4       -999    momeny YY
    4243momentR1        arcsec          REAL    4       -999    first radial moment
    43 momentRH        arcsec          REAL    4       -999    half light radius 
     44momentRH        arcsec          REAL    4       -999    half light radius   (DROP)
    4445momentM3C       arcsec^3        REAL    4       -999    3rd moment sin(theta)
    4546momentM3S       arcsec^3        REAL    4       -999    3rd moment cos(theta)
     
    6667sky             adu/sec/pixel   REAL    4       -999    PSF sky level at source
    6768skyErr          adu/sec/pixel   REAL    4       -999    estimated error in sky
    68 infoFlag        dimensionless   BIGINT  8       -999    flag indicating provenance information
     69infoFlag        dimensionless   INT     4       -999    flag indicating provenance information
     70infoFlag2       dimensionless   INT     4       -999    flag indicating provenance information
    6971dataRelease     dimensionless   TINYINT 1       NA      Data release when this detection was originally taken. Recalibrations do not affect this value.
  • branches/eam_branches/ipp-20140610/ippToPsps/pspsschema/SchemaNew16.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/ForcedMeanObject

    r36815 r36884  
     1
    12objID           dimensionless   BIGINT   8        NA    ODM object identifier index
    2 gcObjID         dimensionless   BIGINT  8         NA    ODM galactic coordinates identifier
     3gcObjID         dimensionless   BIGINT   8        NA    ODM galactic coordinates identifier
    34ippObjID        dimensionless   BIGINT   8        NA    IPP object identifier
    45nDetections     dimensionless   SMALLINT 2      -999    total number of detection measurements in all filters
  • branches/eam_branches/ipp-20140610/ippToPsps/pspsschema/SchemaNew16.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/ForcedWarpMeasurement

    r36815 r36884  
    11objID           dimensionless   BIGINT  8       NA      ODM object identifier
    2 gcObjID         dimensionless   BIGINT  8         NA    ODM galactic coordinates identifier
     2gcObjID         dimensionless   BIGINT  8       NA      ODM galactic coordinates identifier
    33detectID        dimensionless   BIGINT  8       NA      ODM detection identifier
    44ippObjID        dimensionless   BIGINT  8       NA      ippobject id generated by IPP
     
    99randomWarpID    dimensionless   BIGINT  8       NA      Random warp_id
    1010skyCellID       dimensionless   REAL    4       -999    single float giving PrimaryCell.SkyCell identifier
    11 dvoRegionID     dimensionless   REAL    4       -999    identifier to dvo spatial region
     11dvoRegionID     dimensionless   INT     4       -999    identifier to dvo spatial region
    1212obsTime         MeanJulianDays  FLOAT   8       -999    Time of mid observation in Mean Julian Days
    1313------------------------------------------------------
     
    3131momentYY        arcsec^2        REAL    4       -999    momeny YY
    3232momentR1        arcsec^1        REAL    4       -999    first radial moment
    33 momentRH        arcsec          REAL    4       -999    to be half light radius 
     33momentRH        arcsec          REAL    4       -999    to be half light radius   (DROP)
    3434momentM3C       arcsec^3        REAL    4       -999    3rd moment sin(theta)
    3535momentM3S       arcsec^3        REAL    4       -999    3rd moment cos(theta)
  • branches/eam_branches/ipp-20140610/ippToPsps/pspsschema/SchemaNew16.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/MeanObject

    r36815 r36884  
    44
    55objID           dimensionless   BIGINT  8       NA      ODM object identifier index
    6 gcObjID         dimensionless   BIGINT  8         NA    ODM galactic coordinates identifier
     6gcObjID         dimensionless   BIGINT  8        NA     ODM galactic coordinates identifier
    77gQfPerfect      dimensionless   REAL    4       -999    maximum psf qfPerfect from best available g band detections
    88gMeanPSFMag     AB magnitude    REAL    4       -999    mean g psf AB magnitude from best available measurements (best available as current defined by ipp "waterfall logic" 
  • branches/eam_branches/ipp-20140610/ippToPsps/pspsschema/SchemaNew16.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/ObjectThin

    r36815 r36884  
    1010randomID         dimensionless  BIGINT   8      0       Random integer between 0 and 2^32 = 4,394,967,296 remaining ramdom integer 0 
    1111batchID          dimensionless  BIGINT   8      -999    batch id       
    12 dvoRegionID      dimensionless  REAL     4      -999    identifier of dvo spatial region - dvo cat id
     12dvoRegionID      dimensionless  INT      4      -999    identifier of dvo spatial region - dvo cat id
    1313dataRelease      dimensionless  TINYINT  1      NA      Data release Version of this table
    1414objInfoFlag      dimensionless  BIGINT   8      -999    flag indicating odd properties
    1515qualityFlag      dimensionless  TINYINT  1      0       subset of objInfoFlag - flags related to goodness of object
    16 consistencyFlag  dimensionless  SMALLINT 2      0       Value computed from associated detections, it is originally given by IPP and should agree with the ODM validation
     16consistencyFlag  dimensionless  SMALLINT 2      0       Value computed from associated detections, it is originally given by IPP and should agree with the ODM validation (DROP)
    1717raStack          degrees        FLOAT    8      -999    Right Ascension - best weighted RA across filters from stack WHENEVER an object is detected in the stack 
    1818decStack         degrees        FLOAT    8      -999    Declination - best weighted Dec across filters from stack WHENEVER an object is detected in the stack
  • branches/eam_branches/ipp-20140610/ippToPsps/pspsschema/SchemaNew16.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/StackApFlx

    r36815 r36884  
    11
    22objID            dimensionless  BIGINT  8       NA      ODM object identifier
    3 gcObjID         dimensionless   BIGINT  8         NA    ODM galactic coordinates identifier
     3gcObjID          dimensionless  BIGINT  8       NA      ODM galactic coordinates identifier
     4ippObjID         dimensionless  BIGINT  8       NA      ipp object identifier
    45surveyID         dimensionless  TINYINT 1       0       stack type identifier
    56skyCellID        dimensionless  REAL    4       -999    single float giving PrimaryCell.SkyCell identifier
     
    910bestDetection    dimensionless  TINYINT 1       255     identifies if this row is a best detection or not. Also set if only a primary detection exists.   
    1011--                                                      the Primary Dectection, 0 to 3 possible secondary dectections, and the "best" per filter. 
    11 dvoRegionID      dimensionless  REAL    4       -999    identifier to dvo spatial region
     12dvoRegionID     dimensionless   INT    4       -999    identifier to dvo spatial region
    1213dataRelease     dimensionless   TINYINT 1       NA      Data release when this table was loaded.
    1314------------------------------------------------------- replicate to end for each filter g,r,i,z,y
     15gippDetectID    dimensionless   BIGINT  8       NA      stack identifier
    1416gstackDetectID  dimensionless   BIGINT  8       NA      ODM detection identifier
    1517gstackMetaID    dimensionless   BIGINT  8       NA      stack identifier
    16 gippObjID        dimensionless  BIGINT  8       NA      ipp object identifier
    17 gippDetectID    dimensionless   BIGINT  8       NA      stack identifier
    1818--------------------------------------------------------unconvolved
    1919gflxR3          adu/seconds     REAL    4       -999    Flux inside r = 3
  • branches/eam_branches/ipp-20140610/ippToPsps/pspsschema/SchemaNew16.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/StackModelFit

    r36815 r36884  
    11
    22objID            dimensionless  BIGINT  8       NA      ODM object identifier
    3 gcObjID         dimensionless   BIGINT  8         NA    ODM galactic coordinates identifier
     3gcObjID          dimensionless  BIGINT  8       NA      ODM galactic coordinates identifier
     4ippObjID         dimensionless  BIGINT  8       NA      ipp object identifier
    45surveyID         dimensionless  TINYINT 1       NA      survey flag identifier
    56skyCellID        dimensionless  REAL    4       -999    single float giving PrimaryCell.SkyCell identifier
     
    910bestDetection    dimensionless  TINYINT 1       255     identifies if this row is a best detection or not. Also set if only a primary detection exists.   
    1011--                                                      the Primary Dectection, 0 to 3 possible secondary dectections, and the "best" per filter. 
    11 dvoRegionID      dimensionless  REAL    4       -999    identifier to dvo spatial region
     12dvoRegionID      dimensionless  INT     4       -999    identifier to dvo spatial region
    1213dataRelease      dimensionless  TINYINT 1       NA      Data release when this table was loaded
    1314-------------------------------------------------------- replicate below for all filters (grizy)
    14 glogC           dimensionless   REAL    4       -999    concentration index
    15 glogA           dimensionless   REAL    4       -999    asymmetry index
    16 gclump          dimensionless   REAL    4       -999    clumpiness factor   
     15gS2             dimensionless   REAL    4       -999    (un)smoothness (Cheng 2012, Simard 2002)
     16glogRT          dimensionless   REAL    4       -999    total residual (from ellipcally symmetric model)
     17glogRA          dimensionless   REAL    4       -999    asymmetric residual (from ellipcally symmetric model)
     18glogC           dimensionless   REAL    4       -999    concentration index  (Petrosian R_50 / R_90)
     19glogA           dimensionless   REAL    4       -999    log of asymmetry index (Gyory & Bell 2010)
     20gbumpy          dimensionless   REAL    4       -999    Blakeslee bumpiness
     21ghalfLightRad   arcsec          REAL    4       -999    half-light radius
    1722-------------------------------------------------------- replicate below for all filters (grizy)
     23gippDetectID    dimensionless   BIGINT  8       NA      ipp detect identifier
    1824gstackDetectID  dimensionless   BIGINT  8       NA      ODM detection identifier
    1925gstackMetaID    dimensionless   BIGINT  8       NA      stack identifier
    20 gippObjID       dimensionless  BIGINT  8       NA      ipp object identifier
    21 gippDetectID    dimensionless   BIGINT  8       NA      ipp detect identifier
     26----------------------------------------------------------------------------------------
    2227gdeVRadius      arcsec          REAL    4       -999    deVaucouleurs radius
    2328gdeVRadiusErr   arcsec          REAL    4       -999    estimated error in deVaucouleurs radius
  • branches/eam_branches/ipp-20140610/ippToPsps/pspsschema/SchemaNew16.0/PSPS_TABLES/Fundamental_IPP_Data_Product_Tables/StackObject

    r36815 r36884  
    11
    22objID             dimensionless   BIGINT  8       NA      ODM object identifier
    3 gcObjID         dimensionless   BIGINT  8         NA    ODM galactic coordinates identifier
     3gcObjID           dimensionless   BIGINT  8       NA      ODM galactic coordinates identifier
     4ippObjID          dimensionless   BIGINT  8       NA      object ID generated by IPP
    45surveyID          dimensionless   TINYINT 1       NA      survey flag identifier
    56skyCellID         dimensionless   REAL    4       -999    single float giving PrimaryCell.SkyCell identifier
     
    910bestDetection     dimensionless   TINYINT 1       255     identifies if this row is a best detection or not. Also set if only a primary detection exists.   
    1011                                                          the Primary Dectection, 0 to 3 possible secondary dectections, and the "best" per filter. 
    11 dvoRegionID       dimensionless   REAL    4       -999    identifier to dvo spatial region
     12dvoRegionID       dimensionless   INT     4       -999    identifier to dvo spatial region
    1213dataRelease       dimensionless   TINYINT 1       NA      Data release when this detection was originally taken.
    1314------------------------------------------------------------------------------------------
     
    1516-- Replicate the section below for each filter, changing the prefex ("g" in this example)
    1617------------------------------------------------------------------------------------------
    17 gippObjID         dimensionless   BIGINT  8       NA      object ID generated by IPP
    1818gippDetectID      dimensionless   BIGINT  8       NA      detection ID generated by IPP
    1919gstackDetectID    dimensionless   BIGINT  8       NA      ODM detection identifier
    2020gstackMetaID      dimensionless   BIGINT  8       NA      stack identifier
     21------------------------------------------------------------------------------------------
    2122gxPos             arcsec          REAL    4       -999    measured x in sky Cell from PSF fit
    2223gyPos             arcsec          REAL    4       -999    measured y in sky Cell from PSF fit
     
    4142gmomentYY         arcsec^2        REAL    4       -999    moment YY
    4243gmomentR1         arcsec          REAL    4       -999    moment R1
    43 gmomentRH         arcsec          REAL    4       -999    moment RH - or half light radius
     44gmomentRH         arcsec          REAL    4       -999    moment RH - or half light radius (REMOVE)
    4445gPSFFlux          adu/sec         REAL    4       -999    g psf flux from stack
    4546gPSFFluxErr       adu/sec         REAL    4       -999    estimated error of g psf flux from stack
     
    5859gsky              adu/secs/arcsec REAL    4       -999    PSF sky level at source (adu)
    5960gskyErr           adu/secs/arcsec REAL    4       -999    estimated error in sky
    60 ginfoFlag         dimensionless   BIGINT  8       -999    indicator of strange propeties
     61ginfoFlag         dimensionless   INT     4       -999    indicator of strange propeties
     62ginfoFlag2        dimensionless   INT     4       -999    indicator of strange propeties
    6163gnFrames          dimensionless   INT     4       -999    Number of frames contributing to source
    6264
  • branches/eam_branches/ipp-20140610/ippTools/share/remotetool_definebyquery_cam.sql

    r36512 r36884  
    99WHERE
    1010camRun.state = 'new' AND
    11 remoteRun.stage = 'camera' AND
    12 remote_id IS NULL
     11(remoteRun.stage = 'camera' OR remoteRun.state IS NULL) AND
     12remoteComponent.remote_id IS NULL
  • branches/eam_branches/ipp-20140610/ippTools/share/remotetool_definebyquery_stack.sql

    r36512 r36884  
    99WHERE
    1010stackRun.state = 'new' AND
    11 remoteRun.stage = 'stack' AND
    12 remote_id IS NULL
     11(remoteRun.stage = 'stack' OR remoteRun.state IS NULL) AND
     12remoteComponent.remote_id IS NULL
  • branches/eam_branches/ipp-20140610/ippTools/share/remotetool_definebyquery_warp.sql

    r36512 r36884  
    99WHERE
    1010warpRun.state = 'new' AND
    11 remoteRun.stage = 'warp' AND
    12 remote_id IS NULL
     11(remoteRun.stage = 'warp' OR remoteRun.state IS NULL) AND
     12remoteComponent.remote_id IS NULL
  • branches/eam_branches/ipp-20140610/ippconfig

  • branches/eam_branches/ipp-20140610/ippconfig/gpc1/ppStack.config

    r36773 r36884  
    160160    STACK.TYPE              STR   DEEP_STACK  ## needed?
    161161    PSF.INPUT.CLIP.SIMPLE   BOOL  True
    162     PSF.INPUT.MAX           F32   6.0   # never really want >6 pixels in refstack, even on edges
     162    PSF.INPUT.MAX           F32   7.0   # center/edge can vary 1-2 pix, prefer <6 pix but needs to be <7 pix for edges
    163163    PSF.INPUT.CLIP.NSIGMA   F32   1.0   # sample typically on rising side of distribution (set even smaller?)
    164164    PSF.INPUT.THRESH        F32   NAN
     
    168168    PSF.TARGET.AS.MAX       BOOL  TRUE      # Set the target PSF FWHM as the maximum of accepted input FWHM values.
    169169    PSF.TARGET.AS.MAX.EPSILON F32 0.1       # Amount to set the target PSF FWHM larger than the maximum input. Target = eps + max(input)
     170    THRESHOLD.MASK  F32     0.1             # Threshold for mask deconvolution (0..1)
     171    COMBINE.ITER    F32     0.5             # Number of rejection iterations per input
     172    COMBINE.REJ     F32     3.0             # Rejection threshold in combination (sigma)
     173    COMBINE.SYS     F32     0.1             # Relative systematic error in combination
     174    COMBINE.DISCARD F32     0.2             # Discard fraction for Olympic weighted mean
     175    IMAGE.REJ       F32     0.1             # Rejected pixel fraction threshold for rejecting entire image
     176    NMINPIX         S32     4               # Minimum input per pixel
     177    MASK.VAL        STR     SUSPECT,MASK.VALUE,CONV.BAD,GHOST # Mask value of input bad pixels
     178    MASK.BLANKBORDER S32    20              # Mask blank border in final stack output
     179    BSCALEOFFSET    BOOL    TRUE            # HACK for removing bscale offset from input warps because of compression (0.5*BSCALE)
    170180END
    171181
     
    193203    MASK.VAL        STR     SUSPECT,MASK.VALUE,CONV.BAD,GHOST # Mask value of input bad pixels
    194204    MASK.BLANKBORDER S32    20              # Mask blank border in final stack output
     205    BSCALEOFFSET    BOOL    TRUE            # HACK for removing bscale offset from input warps because of compression (0.5*BSCALE)
    195206END
    196207
  • branches/eam_branches/ipp-20140610/ippconfig/gpc1/psastro.config

    r36838 r36884  
    122122# PSASTRO.CATDIR              STR      SYNTH.GRIZY
    123123# PSASTRO.CATDIR                STR     PS1.REF.20120503
    124 PSASTRO.CATDIR               STR     PS1.REF.20120524
    125 
     124# PSASTRO.CATDIR               STR     PS1.REF.20120524
     125PSASTRO.CATDIR               STR     PS1.REF.20140605
    126126
    127127DVO.GETSTAR.PHOTCODE        STR      i
     
    362362
    363363DEFAULT_RECIPE METADATA
    364 #   PSASTRO.CATDIR               STR     PS1.REF.20120503
    365    PSASTRO.CATDIR               STR     PS1.REF.20120524
     364#  PSASTRO.CATDIR               STR     PS1.REF.20120503
     365#  PSASTRO.CATDIR               STR     PS1.REF.20120524
     366   PSASTRO.CATDIR               STR     PS1.REF.20140605
    366367   ZERO.POINT.USE.MEAN          BOOL    TRUE 
    367368END
     
    374375LAP_ASTRO METADATA
    375376#  PSASTRO.CATDIR                STR      3PI.20110505.REFCAT
    376 #   PSASTRO.CATDIR               STR      SYNTH.GRIZY
    377 #   PSASTRO.CATDIR               STR     PS1.REF.20120503
    378    PSASTRO.CATDIR               STR     PS1.REF.20120524
     377#  PSASTRO.CATDIR                STR      SYNTH.GRIZY
     378#  PSASTRO.CATDIR                STR     PS1.REF.20120503
     379#  PSASTRO.CATDIR               STR     PS1.REF.20120524
     380   PSASTRO.CATDIR               STR     PS1.REF.20140605
    379381   ZERO.POINT.USE.MEAN          BOOL    TRUE 
    380382END
     
    405407   DVO.GETSTAR.FIXED.ZEROPT    F32   25.0
    406408
    407    PSASTRO.CATDIR                       STR     PS1.REF.20120524
     409   PSASTRO.CATDIR               STR     PS1.REF.20140605
     410#  PSASTRO.CATDIR                       STR     PS1.REF.20120524
    408411   ZERO.POINT.USE.MEAN                  BOOL    TRUE
    409412   PSASTRO.MAX.NRAW                     S32     0
     
    424427    DVO.GETSTAR.FIXED.ZEROPT    F32   25.0
    425428    DVO.GETSTAR.MIN.MAG.INST    F32   -15.0
    426     PSASTRO.CATDIR                       STR     PS1.REF.20120524
     429#   PSASTRO.CATDIR                       STR     PS1.REF.20120524
     430    PSASTRO.CATDIR               STR     PS1.REF.20140605
    427431    ZERO.POINT.USE.MEAN                  BOOL    TRUE
    428432
     
    443447# - similar to DEEPCAL except for MIN.NSTAR 5 to attemp more edge skycells if poorer
    444448STATICSKY_NIGHTCAL   METADATA
    445    PSASTRO.CATDIR                  STR   PS1.REF.20120524  # reset here to ensure same catalog is used when reprocessing set uniformly
     449#   PSASTRO.CATDIR                  STR   PS1.REF.20120524  # reset here to ensure same catalog is used when reprocessing set uniformly
     450   PSASTRO.CATDIR               STR     PS1.REF.20140605
    446451   REFSTAR_MASK                    BOOL  FALSE
    447452   PSASTRO.SAVE.REFMATCH           BOOL  FALSE
     
    479484# revised setup for DEEP/MDS stacks with range of inputs, should work for N~2(edges)--500 inputs with large MIN/MAX.INST.MAG.RAW
    480485STATICSKY_DEEPCAL   METADATA
    481    PSASTRO.CATDIR                  STR   PS1.REF.20120524  # reset here to ensure same catalog is used when reprocessing set uniformly
     486   #PSASTRO.CATDIR                  STR   PS1.REF.20120524  # reset here to ensure same catalog is used when reprocessing set uniformly
     487   PSASTRO.CATDIR                  STR   PS1.REF.20140605  # ensure same catalog is used when reprocessing MD set uniformly
    482488   REFSTAR_MASK                    BOOL  FALSE
    483489   PSASTRO.SAVE.REFMATCH           BOOL  FALSE
     
    498504   DVO.GETSTAR.MAX.RHO             F32   6000.0  # N/sqdeg, slightly larger than MAX.NREF
    499505   DVO.GETSTAR.MIN.MAG.INST        F32   -25.0   # set absurd range to cover large range of exptime, then clamp...
    500    DVO.GETSTAR.MIN.MAG             F32   15.0    # only used if keyword problem so also using CLAMP_MAG_MIN
    501    REFSTAR_CLAMP_MAG_MIN           F32   15.0    # saturation in MD ~14 even in y-band, so toss out brighter in the list
     506   DVO.GETSTAR.MIN.MAG             F32   16.5    # only used if keyword problem so also using CLAMP_MAG_MIN
     507   REFSTAR_CLAMP_MAG_MIN           F32   16.5    # saturation in MD ~14 even in y-band, so toss out brighter in the list. seeing offset in brighter stars
    502508   DVO.GETSTAR.FIXED.ZEROPT        F32   0.0     # not really needed, exptime overly dominates
    503509 
  • branches/eam_branches/ipp-20140610/ippconfig/recipes/ppStack.config

    r36773 r36884  
    3434TARGET.MINMAG   F32     3.0             # Minimum magnitude difference to tolerate in stamp
    3535NMINPIX         S32     1               # Minimum input per pixel
     36BSCALEOFFSET    BOOL    FALSE           # HACK for removing offset from input warps because of compression (0.5*BSCALE)
    3637
    3738BACKGROUND.MODEL    BOOL   FALSE        # Construct a stacked version of the warp stage background
  • branches/eam_branches/ipp-20140610/ippconfig/recipes/ppSub.config

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20140610/ippconfig/recipes/psphot.config

    r36763 r36884  
    1515
    1616# format for output CMF files
    17 OUTPUT.FORMAT                       STR   PS1_V3
     17OUTPUT.FORMAT                       STR   PS1_V5
    1818
    1919# the zero point is used to set a basic scale for DVO
     
    238238
    239239EXTENDED_SOURCE_MODELS_SELECTION    STR   ALL
     240
     241LENSING_PARAMETERS                  BOOL  FALSE
    240242
    241243# extended source models applied to sources
     
    492494  RADIAL_APERTURES                    BOOL  T    # calculate flux in circular radial apertures?
    493495  RADIAL_APERTURES_SN_LIM             F32   0.0  # S/N limit for radial aperture calculation
    494   OUTPUT.FORMAT                       STR   PS1_SV2
     496  OUTPUT.FORMAT                       STR   PS1_SV3
    495497
    496498  # subtract radial profiles for extremely bright stars?
     
    524526  RADIAL_APERTURES                    BOOL  F    # calculate flux in circular radial apertures?
    525527  RADIAL_APERTURES_SN_LIM             F32   0.0  # S/N limit for radial aperture calculation
    526   OUTPUT.FORMAT                       STR   PS1_SV1
     528  OUTPUT.FORMAT                       STR   PS1_SV3
    527529
    528530  EXT_FIT_MAX_RADIUS                  F32   50.0
     
    731733    SAVE.BACKMDL            BOOL    FALSE
    732734    SAVE.RESID              BOOL    FALSE
    733     OUTPUT.FORMAT           STR     PS1_SV2
    734 END
     735    OUTPUT.FORMAT           STR     PS1_SV3
     736END
  • branches/eam_branches/ipp-20140610/ippconfig/recipes/reductionClasses.mdc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20140610/ppSim/src/ppSimInsertGalaxies.c

    r34261 r36884  
    145145            axes.minor       = galaxy->Rmin;
    146146            axes.theta       = galaxy->theta;
    147             pmPSF_AxesToModel (PAR, axes, type);
     147            pmPSF_AxesToModel (PAR, axes, model->class->useReff);
    148148        }
    149149        psF64 Area = 2.0 * M_PI * galaxy->Rmaj * galaxy->Rmin;
     
    154154
    155155        // XXX let the flux limit be a user-defined number of sky sigmas (not just 1.0)
    156         float radius = model->modelRadius (model->params, 0.1*roughNoise);
     156        float radius = model->class->modelRadius (model->params, 0.1*roughNoise);
    157157        radius = PS_MAX (radius, 1.0);
    158158
     
    163163        pmSource *source = pmSourceFromModel (model, readout, radius, PM_SOURCE_TYPE_EXTENDED);
    164164
    165         galaxy->flux = model->modelFlux (model->params);
     165        galaxy->flux = model->class->modelFlux (model->params);
    166166
    167167        // XXX set the mag & err values (should this be done in pmSourceFromModel?)
  • branches/eam_branches/ipp-20140610/ppSim/src/ppSimInsertStars.c

    r36375 r36884  
    116116        // (inserting flux with a variable radius introduces a flux-dependent bias)
    117117        if (radius < 0) {
    118           radius = model->modelRadius (model->params, nSigmaLim * roughNoise);
     118          radius = model->class->modelRadius (model->params, nSigmaLim * roughNoise);
    119119          radius = PS_MAX (radius,  1.0);
    120120          radius = PS_MIN (radius, 50.0);
     
    126126        // XXX set the mag & err values (should this be done in pmSourceFromModel?)
    127127        // XXX i should be applying the gain and the correct effective area
    128         psEllipseAxes axes = pmPSF_ModelToAxes (model->params->data.F32, model->type);
     128        psEllipseAxes axes = pmPSF_ModelToAxes (model->params->data.F32, model->class->useReff);
    129129        float Area = 2.0 * M_PI * axes.major * axes.minor;
    130130
  • branches/eam_branches/ipp-20140610/ppStack/src/ppStack.h

    r34849 r36884  
    108108                         const psVector *addVariance, // Additional variance for rejection
    109109                         bool safety,                 // Enable safety switch?
    110                          const psVector *norm         // Normalisations to apply
     110                         const psVector *norm,         // Normalisations to apply
     111                         const psVector *bscaleApplyOffset  // hack for offset based on bscale
    111112    );
    112113
  • branches/eam_branches/ipp-20140610/ppStack/src/ppStackCombineFinal.c

    r36717 r36884  
    4444
    4545bool ppStackCombineFinal(ppStackThreadData *stack, psArray *covariances, ppStackOptions *options,
    46                          pmConfig *config, bool safe, bool normalise, bool grow)
     46                         pmConfig *config, bool safe, bool normalise, bool grow, bool bscaleoffset)
    4747{
    4848    psAssert(stack, "Require stack");
     
    107107        PS_ARRAY_ADD_SCALAR(job->args, safe, PS_TYPE_U8);
    108108        PS_ARRAY_ADD_SCALAR(job->args, normalise, PS_TYPE_U8);
     109        PS_ARRAY_ADD_SCALAR(job->args, bscaleoffset, PS_TYPE_U8);
    109110        if (!psThreadJobAddPending(job)) {
    110111            psFree(reject);
  • branches/eam_branches/ipp-20140610/ppStack/src/ppStackLoop.c

    r36365 r36884  
    120120    psTrace("ppStack", 2, "Final stack of convolved images....\n");
    121121    if (options->convolve) {
    122       if (!ppStackCombineFinal(stack, options->convCovars, options, config, false, false, true)) {
     122      if (!ppStackCombineFinal(stack, options->convCovars, options, config, false, false, true, false)) {
    123123        psError(psErrorCodeLast(), false, "Unable to perform final combination.");
    124124        psFree(stack);
     
    128128    else {
    129129      // Since we haven't convolved, I believe we do need to normalize here.
    130       if (!ppStackCombineFinal(stack, options->convCovars, options, config, false, true, true)) {
     130      //MEH -- see below for comment on ppStackCombineFinal and bscaleOffset
     131      if (!ppStackCombineFinal(stack, options->convCovars, options, config, false, true, true, true)) {
    131132        psError(psErrorCodeLast(), false, "Unable to perform final combination.");
    132133        psFree(stack);
     
    207208        // generate the unconvolved stack. NOTE: this one must be normalized since the inputs have not been
    208209        psTrace("ppStack", 2, "Stack of unconvolved images....\n");
    209         if (!ppStackCombineFinal(stack, options->origCovars, options, config, false, true, false)) {
     210        //MEH -- terrible hack for bscale offset to input warps -- treat like normalization
     211        // -- if BSCALEOFFSET TRUE, 0.5*bscale for offset values, otherwise value 0.0
     212        // -- bscaleOffset set when files read in and applied in CombineFinal (if arg true, only valid for unconv case)
     213        if (!ppStackCombineFinal(stack, options->origCovars, options, config, false, true, false, true)) {
    210214            psError(psErrorCodeLast(), false, "Unable to perform unconvolved combination.");
    211215            psFree(stack);
  • branches/eam_branches/ipp-20140610/ppStack/src/ppStackLoop.h

    r34800 r36884  
    6565    bool safe,                          // Allow safe combination?
    6666    bool norm,                          // Normalise images?
    67     bool grow                           // Grow rejection masks?
     67    bool grow,                           // Grow rejection masks?
     68    bool bscaleoffset                   // Apply bscale offset?
    6869    );
    6970
  • branches/eam_branches/ipp-20140610/ppStack/src/ppStackOptions.c

    r35167 r36884  
    1919    psFree(options->inputMask);
    2020    psFree(options->sourceLists);
     21    psFree(options->bscaleOffset);
    2122    psFree(options->norm);
    2223    psFree(options->sources);
     
    6566    options->inputMask = NULL;
    6667    options->sourceLists = NULL;
     68    options->bscaleOffset = NULL;
    6769    options->norm = NULL;
    6870    options->sources = NULL;
  • branches/eam_branches/ipp-20140610/ppStack/src/ppStackOptions.h

    r35167 r36884  
    3535    float clippedMean;                  // clipped mean of input fwhm
    3636    float clippedStdev;                 // clipped stdev of input fwhm
     37    psVector *bscaleOffset;             // hack offset of bzero using 0.5*bscale if option, 0.0 if not
    3738    // Convolve
    3839    psArray *cells;                     // Cells for convolved images --- a handle for reading again
  • branches/eam_branches/ipp-20140610/ppStack/src/ppStackPrepare.c

    r35931 r36884  
    148148    }
    149149
     150    //MEH -- bscale offset hack for warps
     151    options->bscaleOffset = psVectorAlloc(options->num, PS_TYPE_F32);
     152    psVectorInit(options->bscaleOffset, 0.0);
     153    bool setbscaleoffset = psMetadataLookupBool(NULL,recipe, "BSCALEOFFSET");
     154
    150155    psArray *psfs = psArrayAlloc(num); // PSFs for PSF envelope
    151156    int numCols = 0, numRows = 0;   // Size of image
     
    162167        }
    163168        options->sumExposure += options->exposures->data.F32[i];
     169
     170        //MEH -- hdu get redefn again below if conv (lots of this happening..)
     171        if (setbscaleoffset) {
     172            pmHDU *hdu = pmHDUFromCell(cell);
     173            assert(hdu && hdu->header);
     174            float bscale = psMetadataLookupF32(NULL, hdu->header, "BSCALE");
     175            options->bscaleOffset->data.F32[i] = 0.5*bscale;
     176        }
     177        psLogMsg("ppStack", PS_LOG_INFO, "bscaleOffset: %d %f", i,options->bscaleOffset->data.F32[i]);
    164178
    165179        // Get list of PSFs, to determine target PSF
  • branches/eam_branches/ipp-20140610/ppStack/src/ppStackReadout.c

    r36710 r36884  
    3434    bool safety = PS_SCALAR_VALUE(args->data[4], U8);    // Safety switch on?
    3535    bool normalise = PS_SCALAR_VALUE(args->data[5], U8); // Normalise images?
     36    bool bscaleoffset = PS_SCALAR_VALUE(args->data[6], U8); // Apply bscale offset?
    3637
    3738    psVector *mask = options->inputMask; // Mask for inputs
     
    4041    psVector *addVariance = options->matchChi2; // Additional variance when rejecting
    4142    psVector *norm = normalise ? options->norm : NULL; // Normalisations to apply to images
     43    psVector *bscaleApplyOffset = bscaleoffset ? options->bscaleOffset : NULL; // BSCALE offset to apply to images
    4244
    4345    bool status = ppStackReadoutFinal(config, options->outRO, options->expRO, thread->readouts, mask, reject,
    44                                       weightings, exposures, addVariance, safety, norm); // Status of operation
     46                                      weightings, exposures, addVariance, safety, norm, bscaleApplyOffset); // Status of operation
    4547
    4648    thread->busy = false;
     
    201203                         const psVector *mask, const psArray *rejected, const psVector *weightings,
    202204                         const psVector *exposures, const psVector *addVariance, bool safety,
    203                          const psVector *norm)
     205                         const psVector *norm, const psVector *bscaleApplyOffset)
    204206{
    205207    assert(config);
     
    271273        stack->data[i] = data;
    272274
     275        //MEH -- apply bscale offset before norm   
     276        if (bscaleApplyOffset) {
     277            psLogMsg("ppStack", PS_LOG_INFO, "bscaleApplyOffset: %d %f", i, bscaleApplyOffset->data.F32[i]);
     278            psBinaryOp(ro->image, ro->image, "-", psScalarAlloc(bscaleApplyOffset->data.F32[i], PS_TYPE_F32));
     279        }
     280
    273281        if (norm) {
    274282            float normalise = powf(10.0, -0.4 * norm->data.F32[i]); // Normalisation
  • branches/eam_branches/ipp-20140610/ppStack/src/ppStackThread.c

    r34800 r36884  
    277277
    278278    {
    279         psThreadTask *task = psThreadTaskAlloc("PPSTACK_FINAL_COMBINE", 6);
     279        psThreadTask *task = psThreadTaskAlloc("PPSTACK_FINAL_COMBINE", 7);
    280280        task->function = &ppStackReadoutFinalThread;
    281281        psThreadTaskAdd(task);
  • branches/eam_branches/ipp-20140610/ppViz/src/ppVizPSF/ppVizPSFLoop.c

    r34800 r36884  
    117117
    118118                        pmModel *model = pmModelFromPSFforXY(psf, xSrc, ySrc, 1.0); // Model for normalisation
    119                         float fluxNorm = model->modelFlux(model->params);               // Flux for peak=1
     119                        float fluxNorm = model->class->modelFlux(model->params);               // Flux for peak=1
    120120                        float fluxPeak = powf(10.0, -0.4 * data->fakeMag) / fluxNorm; // Peak flux
    121121                        source->peak = pmPeakAlloc(xSrc, ySrc, fluxPeak, PM_PEAK_LONE);
     
    135135                    source->peak = pmPeakAlloc(xSrc, ySrc, 1.0, PM_PEAK_LONE);
    136136                    pmModel *model = pmModelFromPSFforXY(psf, xSrc, ySrc, 1.0); // Model for normalisation
    137                     float flux = model->modelFlux(model->params);               // Flux for peak=1
     137                    float flux = model->class->modelFlux(model->params);               // Flux for peak=1
    138138                    psFree(model);
    139139                    source->psfMag = -2.5 * log10(flux);
  • branches/eam_branches/ipp-20140610/psModules/src/camera/pmFPAfileIO.c

    r36834 r36884  
    3434#include "pmMoments.h"
    3535#include "pmModelFuncs.h"
     36#include "pmModelClass.h"
    3637#include "pmModel.h"
    3738#include "pmSourceMasks.h"
  • branches/eam_branches/ipp-20140610/psModules/src/camera/pmReadoutFake.c

    r36623 r36884  
    2020#include "pmMoments.h"
    2121#include "pmModelFuncs.h"
     22#include "pmModelClass.h"
    2223#include "pmModel.h"
    2324#include "pmModelUtils.h"
    24 #include "pmModelClass.h"
    2525#include "pmSourceMasks.h"
    2626#include "pmSourceExtendedPars.h"
     
    5555
    5656    psF32 *params = model->params->data.F32; // Model parameters
    57     psEllipseAxes axes = pmPSF_ModelToAxes(params, model->type); // Ellipse axes
     57    psEllipseAxes axes = pmPSF_ModelToAxes(params, model->class->useReff); // Ellipse axes
    5858    // Curiously, the minor axis can be larger than the major axis, so need to check.
    5959    if (axes.major >= axes.minor) {
     
    6262        axes.major = axes.minor;
    6363    }
    64     return pmPSF_AxesToModel(params, axes, model->type);
     64    return pmPSF_AxesToModel(params, axes, model->class->useReff);
    6565}
    6666
     
    122122            }
    123123
    124             flux /= normModel->modelFlux(normModel->params);
     124            flux /= normModel->class->modelFlux(normModel->params);
    125125            psFree(normModel);
    126126        }
     
    164164        float fakeRadius = 1.0;         // Radius of fake source
    165165        if (isfinite(minFlux)) {
    166             fakeRadius = PS_MAX(fakeRadius, fakeModel->modelRadius(fakeModel->params, minFlux));
     166            fakeRadius = PS_MAX(fakeRadius, fakeModel->class->modelRadius(fakeModel->params, minFlux));
    167167        }
    168168        if (radius > 0) {
  • branches/eam_branches/ipp-20140610/psModules/src/extras/pmThreadTools.c

    r36623 r36884  
    2929#include "pmMoments.h"
    3030#include "pmModelFuncs.h"
     31#include "pmModelClass.h"
    3132#include "pmModel.h"
    3233#include "pmModelUtils.h"
    33 #include "pmModelClass.h"
    3434#include "pmSourceMasks.h"
    3535#include "pmSourceExtendedPars.h"
  • branches/eam_branches/ipp-20140610/psModules/src/extras/pmVisual.c

    r36834 r36884  
    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 "pmSourceLensing.h"
    44 // #include "pmSource.h"
    45 // #include "pmSourceFitModel.h"
    46 // #include "pmPSF.h"
    47 // #include "pmPSFtry.h"
    48 // #include "pmFPAExtent.h"
    49 // #include "pmAstrometryVisual.h"
    50 // #include "pmSubtractionVisual.h"
    51 // #include "pmStackVisual.h"
    52 // #include "pmSourceVisual.h"
    5325
    5426# if (HAVE_KAPA)
  • branches/eam_branches/ipp-20140610/psModules/src/imcombine/pmPSFEnvelope.c

    r36623 r36884  
    2020#include "pmMoments.h"
    2121#include "pmModelFuncs.h"
     22#include "pmModelClass.h"
    2223#include "pmModel.h"
    2324#include "pmModelUtils.h"
    24 #include "pmModelClass.h"
    2525#include "pmSourceMasks.h"
    2626#include "pmSourceExtendedPars.h"
     
    168168                        continue;
    169169                    }
    170                     model->modelSetLimits(PM_MODEL_LIMITS_MODERATE);
     170                    model->class->modelSetLimits(PM_MODEL_LIMITS_MODERATE);
    171171                    bool limits = true; // Model within limits?
    172172                    for (int j = 0; j < model->params->n && limits; j++) {
    173                         if (!model->modelLimits(PS_MINIMIZE_PARAM_MIN, j, model->params->data.F32, NULL) ||
    174                             !model->modelLimits(PS_MINIMIZE_PARAM_MAX, j, model->params->data.F32, NULL)) {
     173                        if (!model->class->modelLimits(PS_MINIMIZE_PARAM_MIN, j, model->params->data.F32, NULL) ||
     174                            !model->class->modelLimits(PS_MINIMIZE_PARAM_MAX, j, model->params->data.F32, NULL)) {
    175175                            limits = false;
    176176                        }
     
    246246                continue;
    247247            }
    248             float srcRadius = model->modelRadius(model->params, PS_SQR(VARIANCE_VAL)); // Radius for source
     248            float srcRadius = model->class->modelRadius(model->params, PS_SQR(VARIANCE_VAL)); // Radius for source
    249249            psFree(model);
    250250            if (srcRadius == 0) {
  • branches/eam_branches/ipp-20140610/psModules/src/imcombine/pmSubtractionStamps.c

    r36623 r36884  
    2121#include "pmMoments.h"
    2222#include "pmModelFuncs.h"
     23#include "pmModelClass.h"
    2324#include "pmModel.h"
    2425#include "pmSourceMasks.h"
  • branches/eam_branches/ipp-20140610/psModules/src/objects/mksource.pl

    r36623 r36884  
    2424                "PS1_DV2", 2,
    2525                "PS1_DV3", 3,
     26                "PS1_DV4", 4,
    2627    );
    2728%cmfmodes_sv = ("PS1_SV1", 1,
    2829                "PS1_SV2", 2,
     30                "PS1_SV3", 3,
    2931    );
    3032
  • branches/eam_branches/ipp-20140610/psModules/src/objects/models/pmModel_DEV.c

    r36623 r36884  
    3636#include "pmMoments.h"
    3737#include "pmModelFuncs.h"
     38#include "pmModelClass.h"
    3839#include "pmModel.h"
    3940#include "pmModelUtils.h"
    40 #include "pmModelClass.h"
    4141#include "pmSourceMasks.h"
    4242#include "pmSourceExtendedPars.h"
     
    5959# define PM_MODEL_LIMITS          pmModelLimits_DEV
    6060# define PM_MODEL_RADIUS          pmModelRadius_DEV
     61# define PM_MODEL_SET_FWHM        pmModelSetFWHM_DEV
    6162# define PM_MODEL_FROM_PSF        pmModelFromPSF_DEV
    6263# define PM_MODEL_PARAMS_FROM_PSF pmModelParamsFromPSF_DEV
     
    123124    if (radius <= 1.5) {
    124125        // Nsub ~ 10*index^2 + 1
    125         psEllipseAxes axes = pmPSF_ModelToAxes(PAR, pmModelClassGetType ("PS_MODEL_DEV"));
     126        psEllipseAxes axes = pmPSF_ModelToAxes(PAR, true); // DEV uses Reff
    126127        int Nsub = 2 * ((int)(25 / axes.minor)) + 1;
    127128        Nsub = PS_MIN (Nsub, 121);
     
    336337}
    337338
     339psF64 PM_MODEL_SET_FWHM (const psVector *params, psF64 sigma) {
     340  return (NAN);
     341}
     342
    338343bool PM_MODEL_FROM_PSF (pmModel *modelPSF, pmModel *modelFLT, const pmPSF *psf)
    339344{
     
    357362    // the 2D PSF model fits polarization terms (E0,E1,E2)
    358363    // convert to shape terms (SXX,SYY,SXY)
    359     bool useReff = pmModelUseReff (modelPSF->type);
     364    bool useReff = modelPSF->class->useReff;
    360365    if (!pmPSF_FitToModel (out, 0.1, useReff)) {
    361366        psTrace("psModules.objects", 5, "Failed to fit object at (r,c) = (%.1f,%.1f)", in[PM_PAR_YPOS], in[PM_PAR_XPOS]);
     
    411416    // convert to shape terms (SXX,SYY,SXY)
    412417    // XXX user-defined value for limit?
    413     bool useReff = pmModelUseReff (model->type);
     418    bool useReff = model->class->useReff;
    414419    if (!pmPSF_FitToModel (PAR, 0.1, useReff)) {
    415420        psTrace ("psModules.objects", 3, "Failed to fit object at (r,c) = (%.1f,%.1f)", Xo, Yo);
  • branches/eam_branches/ipp-20140610/psModules/src/objects/models/pmModel_DEV.h

    r35560 r36884  
    88psF64 pmModelFlux_DEV(const psVector *params);
    99psF64 pmModelRadius_DEV(const psVector *params, psF64 flux);
     10psF64 pmModelSetFWHM_DEV(const psVector *params, psF64 flux);
    1011bool pmModelFromPSF_DEV(pmModel *modelPSF, pmModel *modelFLT, const pmPSF *psf);
    1112bool  pmModelParamsFromPSF_DEV(pmModel *model, const pmPSF *psf, float Xo, float Yo, float Io);
  • branches/eam_branches/ipp-20140610/psModules/src/objects/models/pmModel_EXP.c

    r36623 r36884  
    3333#include "pmMoments.h"
    3434#include "pmModelFuncs.h"
     35#include "pmModelClass.h"
    3536#include "pmModel.h"
    3637#include "pmModelUtils.h"
    37 #include "pmModelClass.h"
    3838#include "pmSourceMasks.h"
    3939#include "pmSourceExtendedPars.h"
     
    5656# define PM_MODEL_LIMITS          pmModelLimits_EXP
    5757# define PM_MODEL_RADIUS          pmModelRadius_EXP
     58# define PM_MODEL_SET_FWHM        pmModelSetFWHM_EXP
    5859# define PM_MODEL_FROM_PSF        pmModelFromPSF_EXP
    5960# define PM_MODEL_PARAMS_FROM_PSF pmModelParamsFromPSF_EXP
     
    343344}
    344345
     346psF64 PM_MODEL_SET_FWHM (const psVector *params, psF64 sigma) {
     347  return (NAN);
     348}
     349
    345350bool PM_MODEL_FROM_PSF (pmModel *modelPSF, pmModel *modelFLT, const pmPSF *psf)
    346351{
     
    364369    // the 2D PSF model fits polarization terms (E0,E1,E2)
    365370    // convert to shape terms (SXX,SYY,SXY)
    366     bool useReff = pmModelUseReff (modelPSF->type);
     371    bool useReff = modelPSF->class->useReff;
    367372    if (!pmPSF_FitToModel (out, 0.1, useReff)) {
    368373        psTrace("psModules.objects", 5, "Failed to fit object at (r,c) = (%.1f,%.1f)", in[PM_PAR_YPOS], in[PM_PAR_XPOS]);
     
    418423    // convert to shape terms (SXX,SYY,SXY)
    419424    // XXX user-defined value for limit?
    420     bool useReff = pmModelUseReff (model->type);
     425    bool useReff = model->class->useReff;
    421426    if (!pmPSF_FitToModel (PAR, 0.1, useReff)) {
    422427        psTrace ("psModules.objects", 3, "Failed to fit object at (r,c) = (%.1f,%.1f)", Xo, Yo);
  • branches/eam_branches/ipp-20140610/psModules/src/objects/models/pmModel_EXP.h

    r35560 r36884  
    88psF64 pmModelFlux_EXP(const psVector *params);
    99psF64 pmModelRadius_EXP(const psVector *params, psF64 flux);
     10psF64 pmModelSetFWHM_EXP(const psVector *params, psF64 flux);
    1011bool pmModelFromPSF_EXP(pmModel *modelPSF, pmModel *modelFLT, const pmPSF *psf);
    1112bool  pmModelParamsFromPSF_EXP(pmModel *model, const pmPSF *psf, float Xo, float Yo, float Io);
  • branches/eam_branches/ipp-20140610/psModules/src/objects/models/pmModel_GAUSS.c

    r36623 r36884  
    3333#include "pmMoments.h"
    3434#include "pmModelFuncs.h"
     35#include "pmModelClass.h"
    3536#include "pmModel.h"
    3637#include "pmModelUtils.h"
    37 #include "pmModelClass.h"
    3838#include "pmSourceMasks.h"
    3939#include "pmSourceExtendedPars.h"
     
    5454# define PM_MODEL_GUESS           pmModelGuess_GAUSS
    5555# define PM_MODEL_LIMITS          pmModelLimits_GAUSS
     56# define PM_MODEL_SET_FWHM        pmModelSetFWHM_GAUSS
    5657# define PM_MODEL_RADIUS          pmModelRadius_GAUSS
    5758# define PM_MODEL_FROM_PSF        pmModelFromPSF_GAUSS
     
    257258}
    258259
     260psF64 PM_MODEL_SET_FWHM (const psVector *params, psF64 sigma) {
     261    return (2.35482004503*sigma);
     262}
     263
    259264// construct the PSF model from the FLT model and the psf
    260265bool PM_MODEL_FROM_PSF (pmModel *modelPSF, pmModel *modelFLT, const pmPSF *psf)
     
    279284    // the 2D PSF model fits polarization terms (E0,E1,E2)
    280285    // convert to shape terms (SXX,SYY,SXY)
    281     bool useReff = pmModelUseReff (modelPSF->type);
     286    bool useReff = modelPSF->class->useReff;
    282287    if (!pmPSF_FitToModel (out, 0.1, useReff)) {
    283288        psTrace ("psModules.objects", 3, "Failed to fit object at (r,c) = (%.1f,%.1f)", in[PM_PAR_YPOS], in[PM_PAR_XPOS]);
     
    331336    // the 2D PSF model fits polarization terms (E0,E1,E2)
    332337    // convert to shape terms (SXX,SYY,SXY)
    333     bool useReff = pmModelUseReff (model->type);
     338    bool useReff = model->class->useReff;
    334339    if (!pmPSF_FitToModel (PAR, 0.1, useReff)) {
    335340        psTrace ("psModules.objects", 3, "Failed to fit object at (r,c) = (%.1f,%.1f)", Xo, Yo);
  • branches/eam_branches/ipp-20140610/psModules/src/objects/models/pmModel_GAUSS.h

    r35560 r36884  
    88psF64 pmModelFlux_GAUSS(const psVector *params);
    99psF64 pmModelRadius_GAUSS(const psVector *params, psF64 flux);
     10psF64 pmModelSetFWHM_GAUSS(const psVector *params, psF64 flux);
    1011bool pmModelFromPSF_GAUSS(pmModel *modelPSF, pmModel *modelFLT, const pmPSF *psf);
    1112bool  pmModelParamsFromPSF_GAUSS(pmModel *model, const pmPSF *psf, float Xo, float Yo, float Io);
  • branches/eam_branches/ipp-20140610/psModules/src/objects/models/pmModel_PGAUSS.c

    r36623 r36884  
    3333#include "pmMoments.h"
    3434#include "pmModelFuncs.h"
     35#include "pmModelClass.h"
    3536#include "pmModel.h"
    3637#include "pmModelUtils.h"
    37 #include "pmModelClass.h"
    3838#include "pmSourceMasks.h"
    3939#include "pmSourceExtendedPars.h"
     
    5555# define PM_MODEL_LIMITS          pmModelLimits_PGAUSS
    5656# define PM_MODEL_RADIUS          pmModelRadius_PGAUSS
     57# define PM_MODEL_SET_FWHM        pmModelSetFWHM_PGAUSS
    5758# define PM_MODEL_FROM_PSF        pmModelFromPSF_PGAUSS
    5859# define PM_MODEL_PARAMS_FROM_PSF pmModelParamsFromPSF_PGAUSS
     
    324325}
    325326
     327// scale factor is constant for PGAUSS, I found it with the fwhm.sh script
     328psF64 PM_MODEL_SET_FWHM (const psVector *params, psF64 sigma) {
     329    return (3.0063103*sigma);
     330}
     331
    326332bool PM_MODEL_FROM_PSF (pmModel *modelPSF, pmModel *modelFLT, const pmPSF *psf)
    327333{
     
    344350    // the 2D PSF model fits polarization terms (E0,E1,E2)
    345351    // convert to shape terms (SXX,SYY,SXY)
    346     bool useReff = pmModelUseReff (modelPSF->type);
     352    bool useReff = modelPSF->class->useReff;
    347353    if (!pmPSF_FitToModel (out, 0.1, useReff)) {
    348354        psTrace("psModules.objects", 5, "Failed to fit object at (r,c) = (%.1f,%.1f)", in[PM_PAR_YPOS], in[PM_PAR_XPOS]);
     
    396402    // the 2D PSF model fits polarization terms (E0,E1,E2)
    397403    // convert to shape terms (SXX,SYY,SXY)
    398     bool useReff = pmModelUseReff (model->type);
     404    bool useReff = model->class->useReff;
    399405    if (!pmPSF_FitToModel (PAR, 0.1, useReff)) {
    400406        psTrace ("psModules.objects", 3, "Failed to fit object at (r,c) = (%.1f,%.1f)", Xo, Yo);
  • branches/eam_branches/ipp-20140610/psModules/src/objects/models/pmModel_PGAUSS.h

    r35560 r36884  
    88psF64 pmModelFlux_PGAUSS(const psVector *params);
    99psF64 pmModelRadius_PGAUSS(const psVector *params, psF64 flux);
     10psF64 pmModelSetFWHM_PGAUSS(const psVector *params, psF64 flux);
    1011bool pmModelFromPSF_PGAUSS(pmModel *modelPSF, pmModel *modelFLT, const pmPSF *psf);
    1112bool  pmModelParamsFromPSF_PGAUSS(pmModel *model, const pmPSF *psf, float Xo, float Yo, float Io);
  • branches/eam_branches/ipp-20140610/psModules/src/objects/models/pmModel_PS1_V1.c

    r36623 r36884  
    3535#include "pmMoments.h"
    3636#include "pmModelFuncs.h"
     37#include "pmModelClass.h"
    3738#include "pmModel.h"
    3839#include "pmModelUtils.h"
    39 #include "pmModelClass.h"
    4040#include "pmSourceMasks.h"
    4141#include "pmSourceExtendedPars.h"
     
    5757# define PM_MODEL_LIMITS          pmModelLimits_PS1_V1
    5858# define PM_MODEL_RADIUS          pmModelRadius_PS1_V1
     59# define PM_MODEL_SET_FWHM        pmModelSetFWHM_PS1_V1
    5960# define PM_MODEL_FROM_PSF        pmModelFromPSF_PS1_V1
    6061# define PM_MODEL_PARAMS_FROM_PSF pmModelParamsFromPSF_PS1_V1
     
    336337}
    337338
     339// I used the script in models/fwhm.sh to generate the trend of FWHM scaling vs the K value
     340// FWHM = Scale * Sigma (not that PAR[PM_PAR_SXX] = sigma * sqrt(2)
     341//  K : z_hm  : FWHM
     342//  0 : 1.000 : 2.83
     343//  1 : 0.597 : 2.19
     344//  2 : 0.396 : 1.78
     345//  3 : 0.291 : 1.53
     346//  4 : 0.232 : 1.36
     347//  5 : 0.198 : 1.26
     348//  6 : 0.169 : 1.16
     349//  7 : 0.142 : 1.07
     350//  8 : 0.124 : 0.99
     351//  9 : 0.118 : 0.97
     352// 10 : 0.106 : 0.92
     353// 11 : 0.092 : 0.86
     354// 12 : 0.091 : 0.85
     355// 13 : 0.080 : 0.80
     356// 14 : 0.078 : 0.79
     357// 15 : 0.073 : 0.76
     358// 16 : 0.063 : 0.71
     359// 17 : 0.068 : 0.74
     360// 18 : 0.056 : 0.67
     361// 19 : 0.058 : 0.68
     362
     363// static float PS1_V1_Core[] = { 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0};
     364static float PS1_V1_Scale[] = {2.83, 2.19, 1.78, 1.53, 1.36, 1.26, 1.16, 1.07, 0.99, 0.97, 0.92, 0.86, 0.85, 0.80, 0.79, 0.76, 0.71, 0.74, 0.67, 0.68};
     365
     366psF64 PM_MODEL_SET_FWHM (const psVector *params, psF64 sigma) {
     367
     368    psF32 *PAR = params->data.F32;
     369
     370    float core = PAR[PM_PAR_7];
     371
     372    if (!isfinite(core)) return (2.0*M_SQRT2*sigma);
     373
     374    // if PS1_V1_Core is defined as a set of integer steps, so we can simplify:
     375    int binCore = MAX(0, MIN (19, (int)core));
     376
     377    float scale = NAN;
     378    if (binCore == 0) {
     379        scale = (core - binCore + 0) * (PS1_V1_Scale[binCore + 1] - PS1_V1_Scale[binCore + 0]) + PS1_V1_Scale[binCore + 0];
     380    } else {
     381        scale = (core - binCore - 1) * (PS1_V1_Scale[binCore + 0] - PS1_V1_Scale[binCore - 1]) + PS1_V1_Scale[binCore - 1];
     382    }
     383
     384    return (scale * sigma);
     385}
     386
    338387bool PM_MODEL_FROM_PSF (pmModel *modelPSF, pmModel *modelFLT, const pmPSF *psf)
    339388{
    340 
    341389    psF32 *out = modelPSF->params->data.F32;
    342390    psF32 *in  = modelFLT->params->data.F32;
     
    357405    // the 2D PSF model fits polarization terms (E0,E1,E2)
    358406    // convert to shape terms (SXX,SYY,SXY)
    359     bool useReff = pmModelUseReff (modelPSF->type);
     407    bool useReff = modelPSF->class->useReff;
    360408    if (!pmPSF_FitToModel (out, 0.1, useReff)) {
    361409        psTrace("psModules.objects", 5, "Failed to fit object at (r,c) = (%.1f,%.1f)", in[PM_PAR_YPOS], in[PM_PAR_XPOS]);
     
    411459    // convert to shape terms (SXX,SYY,SXY)
    412460    // XXX user-defined value for limit?
    413     bool useReff = pmModelUseReff (model->type);
     461    bool useReff = model->class->useReff;
    414462    if (!pmPSF_FitToModel (PAR, 0.1, useReff)) {
    415463        psTrace ("psModules.objects", 3, "Failed to fit object at (r,c) = (%.1f,%.1f)", Xo, Yo);
  • branches/eam_branches/ipp-20140610/psModules/src/objects/models/pmModel_PS1_V1.h

    r35560 r36884  
    88psF64 pmModelFlux_PS1_V1(const psVector *params);
    99psF64 pmModelRadius_PS1_V1(const psVector *params, psF64 flux);
     10psF64 pmModelSetFWHM_PS1_V1(const psVector *params, psF64 flux);
    1011bool pmModelFromPSF_PS1_V1(pmModel *modelPSF, pmModel *modelFLT, const pmPSF *psf);
    1112bool  pmModelParamsFromPSF_PS1_V1(pmModel *model, const pmPSF *psf, float Xo, float Yo, float Io);
  • branches/eam_branches/ipp-20140610/psModules/src/objects/models/pmModel_QGAUSS.c

    r36623 r36884  
    3535#include "pmMoments.h"
    3636#include "pmModelFuncs.h"
     37#include "pmModelClass.h"
    3738#include "pmModel.h"
    3839#include "pmModelUtils.h"
    39 #include "pmModelClass.h"
    4040#include "pmSourceMasks.h"
    4141#include "pmSourceExtendedPars.h"
     
    5757# define PM_MODEL_LIMITS          pmModelLimits_QGAUSS
    5858# define PM_MODEL_RADIUS          pmModelRadius_QGAUSS
     59# define PM_MODEL_SET_FWHM        pmModelSetFWHM_QGAUSS
    5960# define PM_MODEL_FROM_PSF        pmModelFromPSF_QGAUSS
    6061# define PM_MODEL_PARAMS_FROM_PSF pmModelParamsFromPSF_QGAUSS
     
    337338}
    338339
     340// I used the script in models/fwhm.sh to generate the trend of FWHM scaling vs the K value
     341// FWHM = Scale * Sigma (not that PAR[PM_PAR_SXX] = sigma * sqrt(2)
     342//  K : z_hm  : FWHM
     343//  0 : 1.000 : 2.83
     344//  1 : 0.648 : 2.28
     345//  2 : 0.430 : 1.85
     346//  3 : 0.310 : 1.58
     347//  4 : 0.244 : 1.40
     348//  5 : 0.200 : 1.26
     349//  6 : 0.165 : 1.15
     350//  7 : 0.149 : 1.09
     351//  8 : 0.125 : 1.00
     352//  9 : 0.116 : 0.96
     353// 10 : 0.101 : 0.90
     354// 11 : 0.095 : 0.87
     355// 12 : 0.083 : 0.82
     356// 13 : 0.082 : 0.81
     357// 14 : 0.080 : 0.80
     358// 15 : 0.074 : 0.77
     359// 16 : 0.064 : 0.71
     360// 17 : 0.068 : 0.74
     361// 18 : 0.057 : 0.67
     362// 19 : 0.058 : 0.68
     363
     364// static float QGAUSS_Core[] = { 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0};
     365static float QGAUSS_Scale[] = {2.83, 2.28, 1.85, 1.58, 1.40, 1.26, 1.15, 1.09, 1.00, 0.96, 0.90, 0.87, 0.82, 0.81, 0.80, 0.77, 0.71, 0.74, 0.67, 0.68};
     366
     367psF64 PM_MODEL_SET_FWHM (const psVector *params, psF64 sigma) {
     368
     369    psF32 *PAR = params->data.F32;
     370
     371    float core = PAR[PM_PAR_7];
     372
     373    if (!isfinite(core)) return (2.0*M_SQRT2*sigma);
     374
     375    // QGAUSS_Core is defined as a set of integer steps, so we can simplify:
     376    int binCore = MAX(0, MIN (19, (int)core));
     377
     378    float scale = NAN;
     379    if (binCore == 0) {
     380        scale = (core - binCore + 0) * (QGAUSS_Scale[binCore + 1] - QGAUSS_Scale[binCore + 0]) + QGAUSS_Scale[binCore + 0];
     381    } else {
     382        scale = (core - binCore - 1) * (QGAUSS_Scale[binCore + 0] - QGAUSS_Scale[binCore - 1]) + QGAUSS_Scale[binCore - 1];
     383    }
     384
     385    return (scale * sigma);
     386}
     387
    339388bool PM_MODEL_FROM_PSF (pmModel *modelPSF, pmModel *modelFLT, const pmPSF *psf)
    340389{
     
    358407    // the 2D PSF model fits polarization terms (E0,E1,E2)
    359408    // convert to shape terms (SXX,SYY,SXY)
    360     bool useReff = pmModelUseReff (modelPSF->type);
     409    bool useReff = modelPSF->class->useReff;
    361410    if (!pmPSF_FitToModel (out, 0.1, useReff)) {
    362411        psTrace("psModules.objects", 5, "Failed to fit object at (r,c) = (%.1f,%.1f)", in[PM_PAR_YPOS], in[PM_PAR_XPOS]);
     
    416465    // the 2D PSF model fits polarization terms (E0,E1,E2)
    417466    // convert to shape terms (SXX,SYY,SXY)
    418     bool useReff = pmModelUseReff (model->type);
     467    bool useReff = model->class->useReff;
    419468    if (!pmPSF_FitToModel (PAR, 0.1, useReff)) {
    420469        psTrace ("psModules.objects", 3, "Failed to fit object at (r,c) = (%.1f,%.1f)", Xo, Yo);
  • branches/eam_branches/ipp-20140610/psModules/src/objects/models/pmModel_QGAUSS.h

    r35560 r36884  
    88psF64 pmModelFlux_QGAUSS(const psVector *params);
    99psF64 pmModelRadius_QGAUSS(const psVector *params, psF64 flux);
     10psF64 pmModelSetFWHM_QGAUSS(const psVector *params, psF64 flux);
    1011bool pmModelFromPSF_QGAUSS(pmModel *modelPSF, pmModel *modelFLT, const pmPSF *psf);
    1112bool  pmModelParamsFromPSF_QGAUSS(pmModel *model, const pmPSF *psf, float Xo, float Yo, float Io);
  • branches/eam_branches/ipp-20140610/psModules/src/objects/models/pmModel_RGAUSS.c

    r36623 r36884  
    3434#include "pmMoments.h"
    3535#include "pmModelFuncs.h"
     36#include "pmModelClass.h"
    3637#include "pmModel.h"
    3738#include "pmModelUtils.h"
    38 #include "pmModelClass.h"
    3939#include "pmSourceMasks.h"
    4040#include "pmSourceExtendedPars.h"
     
    5656# define PM_MODEL_LIMITS          pmModelLimits_RGAUSS
    5757# define PM_MODEL_RADIUS          pmModelRadius_RGAUSS
     58# define PM_MODEL_SET_FWHM        pmModelSetFWHM_RGAUSS
    5859# define PM_MODEL_FROM_PSF        pmModelFromPSF_RGAUSS
    5960# define PM_MODEL_PARAMS_FROM_PSF pmModelParamsFromPSF_RGAUSS
     
    330331}
    331332
     333psF64 PM_MODEL_SET_FWHM (const psVector *params, psF64 sigma) {
     334  return (NAN);
     335}
     336
    332337bool PM_MODEL_FROM_PSF (pmModel *modelPSF, pmModel *modelFLT, const pmPSF *psf)
    333338{
     
    351356    // the 2D PSF model fits polarization terms (E0,E1,E2)
    352357    // convert to shape terms (SXX,SYY,SXY)
    353     bool useReff = pmModelUseReff (modelPSF->type);
     358    bool useReff = modelPSF->class->useReff;
    354359    if (!pmPSF_FitToModel (out, 0.1, useReff)) {
    355360        psTrace("psModules.objects", 5, "Failed to fit object at (r,c) = (%.1f,%.1f)", in[PM_PAR_YPOS], in[PM_PAR_XPOS]);
     
    404409    // the 2D PSF model fits polarization terms (E0,E1,E2)
    405410    // convert to shape terms (SXX,SYY,SXY)
    406     bool useReff = pmModelUseReff (model->type);
     411    bool useReff = model->class->useReff;
    407412    if (!pmPSF_FitToModel (PAR, 0.1, useReff)) {
    408413        psTrace ("psModules.objects", 3, "Failed to fit object at (r,c) = (%.1f,%.1f)", Xo, Yo);
  • branches/eam_branches/ipp-20140610/psModules/src/objects/models/pmModel_RGAUSS.h

    r35560 r36884  
    88psF64 pmModelFlux_RGAUSS(const psVector *params);
    99psF64 pmModelRadius_RGAUSS(const psVector *params, psF64 flux);
     10psF64 pmModelSetFWHM_RGAUSS(const psVector *params, psF64 flux);
    1011bool pmModelFromPSF_RGAUSS(pmModel *modelPSF, pmModel *modelFLT, const pmPSF *psf);
    1112bool  pmModelParamsFromPSF_RGAUSS(pmModel *model, const pmPSF *psf, float Xo, float Yo, float Io);
  • branches/eam_branches/ipp-20140610/psModules/src/objects/models/pmModel_SERSIC.c

    r36762 r36884  
    4343#include "pmMoments.h"
    4444#include "pmModelFuncs.h"
     45#include "pmModelClass.h"
    4546#include "pmModel.h"
    4647#include "pmModelUtils.h"
    47 #include "pmModelClass.h"
    4848#include "pmSourceMasks.h"
    4949#include "pmSourceExtendedPars.h"
     
    6666# define PM_MODEL_LIMITS          pmModelLimits_SERSIC
    6767# define PM_MODEL_RADIUS          pmModelRadius_SERSIC
     68# define PM_MODEL_SET_FWHM        pmModelSetFWHM_SERSIC
    6869# define PM_MODEL_FROM_PSF        pmModelFromPSF_SERSIC
    6970# define PM_MODEL_PARAMS_FROM_PSF pmModelParamsFromPSF_SERSIC
     
    124125    if (radius <= 1.5) {
    125126        // Nsub ~ 10*index^2 + 1
    126         psEllipseAxes axes = pmPSF_ModelToAxes(PAR, pmModelClassGetType ("PS_MODEL_SERSIC"));
     127        psEllipseAxes axes = pmPSF_ModelToAxes(PAR, true); // SERSIC model uses Reff
    127128        int Nsub = 2 * ((int)(6.0*Sindex / axes.minor)) + 1;
    128129        Nsub = PS_MIN (Nsub, 121);
     
    357358}
    358359
     360psF64 PM_MODEL_SET_FWHM (const psVector *params, psF64 sigma) {
     361  return (NAN);
     362}
     363
    359364bool PM_MODEL_FROM_PSF (pmModel *modelPSF, pmModel *modelFLT, const pmPSF *psf)
    360365{
     
    378383    // the 2D PSF model fits polarization terms (E0,E1,E2)
    379384    // convert to shape terms (SXX,SYY,SXY)
    380     bool useReff = pmModelUseReff (modelPSF->type);
     385    bool useReff = modelPSF->class->useReff;
    381386    if (!pmPSF_FitToModel (out, 0.1, useReff)) {
    382387        psTrace("psModules.objects", 5, "Failed to fit object at (r,c) = (%.1f,%.1f)", in[PM_PAR_YPOS], in[PM_PAR_XPOS]);
     
    432437    // convert to shape terms (SXX,SYY,SXY)
    433438    // XXX user-defined value for limit?
    434     bool useReff = pmModelUseReff (model->type);
     439    bool useReff = model->class->useReff;
    435440    if (!pmPSF_FitToModel (PAR, 0.1, useReff)) {
    436441        psTrace ("psModules.objects", 3, "Failed to fit object at (r,c) = (%.1f,%.1f)", Xo, Yo);
  • branches/eam_branches/ipp-20140610/psModules/src/objects/models/pmModel_SERSIC.h

    r35560 r36884  
    88psF64 pmModelFlux_SERSIC(const psVector *params);
    99psF64 pmModelRadius_SERSIC(const psVector *params, psF64 flux);
     10psF64 pmModelSetFWHM_SERSIC(const psVector *params, psF64 flux);
    1011bool pmModelFromPSF_SERSIC(pmModel *modelPSF, pmModel *modelFLT, const pmPSF *psf);
    1112bool  pmModelParamsFromPSF_SERSIC(pmModel *model, const pmPSF *psf, float Xo, float Yo, float Io);
  • branches/eam_branches/ipp-20140610/psModules/src/objects/models/pmModel_TRAIL.c

    r36623 r36884  
    55 * The meaning of the parameters may thus vary depending on the specifics of the model.
    66 * All models which are used as a PSF representations share a few parameters, for which #
     7#include "pmModelClass.h"
    78 * define names are listed in pmModel.h:
    89
     
    3334#include "pmMoments.h"
    3435#include "pmModelFuncs.h"
     36#include "pmModelClass.h"
    3537#include "pmModel.h"
    3638#include "pmModelUtils.h"
    37 #include "pmModelClass.h"
    3839#include "pmSourceMasks.h"
    3940#include "pmSourceExtendedPars.h"
     
    5556# define PM_MODEL_LIMITS          pmModelLimits_TRAIL
    5657# define PM_MODEL_RADIUS          pmModelRadius_TRAIL
     58# define PM_MODEL_SET_FWHM        pmModelSetFWHM_TRAIL
    5759# define PM_MODEL_FROM_PSF        pmModelFromPSF_TRAIL
    5860# define PM_MODEL_PARAMS_FROM_PSF pmModelParamsFromPSF_TRAIL
     
    352354
    353355    psF32 *psfPAR  = source->modelPSF->params->data.F32;
    354     bool useReff = pmModelUseReff (source->modelPSF->type);
     356    bool useReff = source->modelPSF->class->useReff;
    355357
    356358    psEllipseAxes psfAxes;
     
    413415    // PAR_LENGTH is the unconvolved length.  add a bit for safety
    414416    return (0.5*PAR[PM_PAR_LENGTH] + 2);
     417}
     418
     419psF64 PM_MODEL_SET_FWHM (const psVector *params, psF64 sigma) {
     420  return (NAN);
    415421}
    416422
  • branches/eam_branches/ipp-20140610/psModules/src/objects/models/pmModel_TRAIL.h

    r35560 r36884  
    88psF64 pmModelFlux_TRAIL(const psVector *params);
    99psF64 pmModelRadius_TRAIL(const psVector *params, psF64 flux);
     10psF64 pmModelSetFWHM_TRAIL(const psVector *params, psF64 flux);
    1011bool pmModelFromPSF_TRAIL(pmModel *modelPSF, pmModel *modelFLT, const pmPSF *psf);
    1112bool  pmModelParamsFromPSF_TRAIL(pmModel *model, const pmPSF *psf, float Xo, float Yo, float Io);
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmDetEff.c

    r36623 r36884  
    1717#include "pmMoments.h"
    1818#include "pmModelFuncs.h"
     19#include "pmModelClass.h"
    1920#include "pmModel.h"
    2021#include "pmModelUtils.h"
    21 #include "pmModelClass.h"
    2222#include "pmSourceMasks.h"
    2323#include "pmSourceExtendedPars.h"
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmGrowthCurve.c

    r36623 r36884  
    3030#include "pmMoments.h"
    3131#include "pmModelFuncs.h"
     32#include "pmModelClass.h"
    3233#include "pmModel.h"
    3334#include "pmModelUtils.h"
    34 #include "pmModelClass.h"
    3535#include "pmSourceMasks.h"
    3636#include "pmSourceExtendedPars.h"
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmGrowthCurveGenerate.c

    r36623 r36884  
    3737#include "pmMoments.h"
    3838#include "pmModelFuncs.h"
     39#include "pmModelClass.h"
    3940#include "pmModel.h"
    4041#include "pmModelUtils.h"
    41 #include "pmModelClass.h"
    4242#include "pmSourceMasks.h"
    4343#include "pmSourceExtendedPars.h"
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmModel.c

    r36834 r36884  
    3333#include "pmMoments.h"
    3434#include "pmModelFuncs.h"
     35#include "pmModelClass.h"
    3536#include "pmModel.h"
    36 #include "pmModelClass.h"
    3737
    3838static void modelFree(pmModel *tmp)
     
    9292    }
    9393
    94     tmp->modelFunc          = class->modelFunc;
    95     tmp->modelFlux          = class->modelFlux;
    96     tmp->modelRadius        = class->modelRadius;
    97     tmp->modelLimits        = class->modelLimits;
    98     tmp->modelGuess         = class->modelGuess;
    99     tmp->modelFromPSF       = class->modelFromPSF;
    100     tmp->modelParamsFromPSF = class->modelParamsFromPSF;
    101     tmp->modelFitStatus     = class->modelFitStatus;
    102     tmp->modelSetLimits     = class->modelSetLimits;
     94    tmp->class = class;
     95
     96    // tmp->modelFunc          = class->modelFunc;
     97    // tmp->modelFlux          = class->modelFlux;
     98    // tmp->modelRadius        = class->modelRadius;
     99    // tmp->modelLimits        = class->modelLimits;
     100    // tmp->modelGuess         = class->modelGuess;
     101    // tmp->modelFromPSF       = class->modelFromPSF;
     102    // tmp->modelParamsFromPSF = class->modelParamsFromPSF;
     103    // tmp->modelFitStatus     = class->modelFitStatus;
     104    // tmp->modelSetLimits     = class->modelSetLimits;
    103105
    104106    psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__);
     
    158160    psF32 tmpF;
    159161
    160     tmpF = model->modelFunc (NULL, model->params, x);
     162    tmpF = model->class->modelFunc (NULL, model->params, x);
    161163    psFree(x);
    162164    psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__);
     
    178180    psF32 tmpF;
    179181
    180     tmpF = model->modelFunc (NULL, model->params, x);
     182    tmpF = model->class->modelFunc (NULL, model->params, x);
    181183    psFree(x);
    182184    psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__);
     
    285287            // add in the desired components for this coordinate
    286288            if (mode & PM_MODEL_OP_FUNC) {
    287                 pixelValue += model->modelFunc (NULL, params, x);
     289                pixelValue += model->class->modelFunc (NULL, params, x);
    288290            }
    289291
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmModel.h

    r31153 r36884  
    4747    bool isPCM;                         ///< is this model fitted with PSF-convolution?
    4848
     49    pmModelClass *class;
     50
    4951    // functions for this model which depend on the model class
    50     pmModelFunc          modelFunc;
    51     pmModelFlux          modelFlux;
    52     pmModelRadius        modelRadius;
    53     pmModelLimits        modelLimits;
    54     pmModelGuessFunc     modelGuess;
    55     pmModelFromPSFFunc   modelFromPSF;
    56     pmModelParamsFromPSF modelParamsFromPSF;
    57     pmModelFitStatusFunc modelFitStatus;
    58     pmModelSetLimitsFunc modelSetLimits;
     52   
     53    // pmModelFunc          modelFunc;
     54    // pmModelFlux          modelFlux;
     55    // pmModelRadius        modelRadius;
     56    // pmModelLimits        modelLimits;
     57    // pmModelGuessFunc     modelGuess;
     58    // pmModelFromPSFFunc   modelFromPSF;
     59    // pmModelParamsFromPSF modelParamsFromPSF;
     60    // pmModelFitStatusFunc modelFitStatus;
     61    // pmModelSetLimitsFunc modelSetLimits;
    5962};
    6063
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmModelClass.c

    r36441 r36884  
    3333#include "pmMoments.h"
    3434#include "pmModelFuncs.h"
     35#include "pmModelClass.h"
    3536#include "pmModel.h"
    3637#include "pmModelUtils.h"
    37 #include "pmModelClass.h"
    3838
    3939#include "pmErrorCodes.h"
     
    5454
    5555static pmModelClass defaultModels[] = {
    56     {"PS_MODEL_GAUSS",        7, (pmModelFunc)pmModelFunc_GAUSS,   (pmModelFlux)pmModelFlux_GAUSS,   (pmModelRadius)pmModelRadius_GAUSS,   (pmModelLimits)pmModelLimits_GAUSS,   (pmModelGuessFunc)pmModelGuess_GAUSS,  (pmModelFromPSFFunc)pmModelFromPSF_GAUSS,  (pmModelParamsFromPSF)pmModelParamsFromPSF_GAUSS,  (pmModelFitStatusFunc)pmModelFitStatus_GAUSS,  (pmModelSetLimitsFunc)pmModelSetLimits_GAUSS  },
    57     {"PS_MODEL_PGAUSS",       7, (pmModelFunc)pmModelFunc_PGAUSS,  (pmModelFlux)pmModelFlux_PGAUSS,  (pmModelRadius)pmModelRadius_PGAUSS,  (pmModelLimits)pmModelLimits_PGAUSS,  (pmModelGuessFunc)pmModelGuess_PGAUSS, (pmModelFromPSFFunc)pmModelFromPSF_PGAUSS, (pmModelParamsFromPSF)pmModelParamsFromPSF_PGAUSS, (pmModelFitStatusFunc)pmModelFitStatus_PGAUSS, (pmModelSetLimitsFunc)pmModelSetLimits_PGAUSS },
    58     {"PS_MODEL_QGAUSS",       8, (pmModelFunc)pmModelFunc_QGAUSS,  (pmModelFlux)pmModelFlux_QGAUSS,  (pmModelRadius)pmModelRadius_QGAUSS,  (pmModelLimits)pmModelLimits_QGAUSS,  (pmModelGuessFunc)pmModelGuess_QGAUSS, (pmModelFromPSFFunc)pmModelFromPSF_QGAUSS, (pmModelParamsFromPSF)pmModelParamsFromPSF_QGAUSS, (pmModelFitStatusFunc)pmModelFitStatus_QGAUSS, (pmModelSetLimitsFunc)pmModelSetLimits_QGAUSS },
    59     {"PS_MODEL_PS1_V1",       8, (pmModelFunc)pmModelFunc_PS1_V1,  (pmModelFlux)pmModelFlux_PS1_V1,  (pmModelRadius)pmModelRadius_PS1_V1,  (pmModelLimits)pmModelLimits_PS1_V1,  (pmModelGuessFunc)pmModelGuess_PS1_V1, (pmModelFromPSFFunc)pmModelFromPSF_PS1_V1, (pmModelParamsFromPSF)pmModelParamsFromPSF_PS1_V1, (pmModelFitStatusFunc)pmModelFitStatus_PS1_V1, (pmModelSetLimitsFunc)pmModelSetLimits_PS1_V1 },
    60     {"PS_MODEL_RGAUSS",       8, (pmModelFunc)pmModelFunc_RGAUSS,  (pmModelFlux)pmModelFlux_RGAUSS,  (pmModelRadius)pmModelRadius_RGAUSS,  (pmModelLimits)pmModelLimits_RGAUSS,  (pmModelGuessFunc)pmModelGuess_RGAUSS, (pmModelFromPSFFunc)pmModelFromPSF_RGAUSS, (pmModelParamsFromPSF)pmModelParamsFromPSF_RGAUSS, (pmModelFitStatusFunc)pmModelFitStatus_RGAUSS, (pmModelSetLimitsFunc)pmModelSetLimits_RGAUSS },
    61     {"PS_MODEL_SERSIC",       8, (pmModelFunc)pmModelFunc_SERSIC,  (pmModelFlux)pmModelFlux_SERSIC,  (pmModelRadius)pmModelRadius_SERSIC,  (pmModelLimits)pmModelLimits_SERSIC,  (pmModelGuessFunc)pmModelGuess_SERSIC, (pmModelFromPSFFunc)pmModelFromPSF_SERSIC, (pmModelParamsFromPSF)pmModelParamsFromPSF_SERSIC, (pmModelFitStatusFunc)pmModelFitStatus_SERSIC, (pmModelSetLimitsFunc)pmModelSetLimits_SERSIC },
    62     {"PS_MODEL_EXP",          7, (pmModelFunc)pmModelFunc_EXP,     (pmModelFlux)pmModelFlux_EXP,     (pmModelRadius)pmModelRadius_EXP,     (pmModelLimits)pmModelLimits_EXP,     (pmModelGuessFunc)pmModelGuess_EXP,    (pmModelFromPSFFunc)pmModelFromPSF_EXP,    (pmModelParamsFromPSF)pmModelParamsFromPSF_EXP,    (pmModelFitStatusFunc)pmModelFitStatus_EXP,    (pmModelSetLimitsFunc)pmModelSetLimits_EXP    },
    63     {"PS_MODEL_DEV",          7, (pmModelFunc)pmModelFunc_DEV,     (pmModelFlux)pmModelFlux_DEV,     (pmModelRadius)pmModelRadius_DEV,     (pmModelLimits)pmModelLimits_DEV,     (pmModelGuessFunc)pmModelGuess_DEV,    (pmModelFromPSFFunc)pmModelFromPSF_DEV,    (pmModelParamsFromPSF)pmModelParamsFromPSF_DEV,    (pmModelFitStatusFunc)pmModelFitStatus_DEV,    (pmModelSetLimitsFunc)pmModelSetLimits_DEV    },
    64     {"PS_MODEL_TRAIL",        7, (pmModelFunc)pmModelFunc_TRAIL,   (pmModelFlux)pmModelFlux_TRAIL,   (pmModelRadius)pmModelRadius_TRAIL,   (pmModelLimits)pmModelLimits_TRAIL,   (pmModelGuessFunc)pmModelGuess_TRAIL,  (pmModelFromPSFFunc)pmModelFromPSF_TRAIL,  (pmModelParamsFromPSF)pmModelParamsFromPSF_TRAIL,  (pmModelFitStatusFunc)pmModelFitStatus_TRAIL,  (pmModelSetLimitsFunc)pmModelSetLimits_TRAIL  },
     56    {"PS_MODEL_GAUSS",        7, 0, (pmModelFunc)pmModelFunc_GAUSS,   (pmModelFlux)pmModelFlux_GAUSS,   (pmModelRadius)pmModelRadius_GAUSS,   (pmModelSetFWHM)pmModelSetFWHM_GAUSS,   (pmModelLimits)pmModelLimits_GAUSS,   (pmModelGuessFunc)pmModelGuess_GAUSS,  (pmModelFromPSFFunc)pmModelFromPSF_GAUSS,  (pmModelParamsFromPSF)pmModelParamsFromPSF_GAUSS,  (pmModelFitStatusFunc)pmModelFitStatus_GAUSS,  (pmModelSetLimitsFunc)pmModelSetLimits_GAUSS  },
     57    {"PS_MODEL_PGAUSS",       7, 0, (pmModelFunc)pmModelFunc_PGAUSS,  (pmModelFlux)pmModelFlux_PGAUSS,  (pmModelRadius)pmModelRadius_PGAUSS,  (pmModelSetFWHM)pmModelSetFWHM_PGAUSS,  (pmModelLimits)pmModelLimits_PGAUSS,  (pmModelGuessFunc)pmModelGuess_PGAUSS, (pmModelFromPSFFunc)pmModelFromPSF_PGAUSS, (pmModelParamsFromPSF)pmModelParamsFromPSF_PGAUSS, (pmModelFitStatusFunc)pmModelFitStatus_PGAUSS, (pmModelSetLimitsFunc)pmModelSetLimits_PGAUSS },
     58    {"PS_MODEL_QGAUSS",       8, 0, (pmModelFunc)pmModelFunc_QGAUSS,  (pmModelFlux)pmModelFlux_QGAUSS,  (pmModelRadius)pmModelRadius_QGAUSS,  (pmModelSetFWHM)pmModelSetFWHM_QGAUSS,  (pmModelLimits)pmModelLimits_QGAUSS,  (pmModelGuessFunc)pmModelGuess_QGAUSS, (pmModelFromPSFFunc)pmModelFromPSF_QGAUSS, (pmModelParamsFromPSF)pmModelParamsFromPSF_QGAUSS, (pmModelFitStatusFunc)pmModelFitStatus_QGAUSS, (pmModelSetLimitsFunc)pmModelSetLimits_QGAUSS },
     59    {"PS_MODEL_PS1_V1",       8, 0, (pmModelFunc)pmModelFunc_PS1_V1,  (pmModelFlux)pmModelFlux_PS1_V1,  (pmModelRadius)pmModelRadius_PS1_V1,  (pmModelSetFWHM)pmModelSetFWHM_PS1_V1,  (pmModelLimits)pmModelLimits_PS1_V1,  (pmModelGuessFunc)pmModelGuess_PS1_V1, (pmModelFromPSFFunc)pmModelFromPSF_PS1_V1, (pmModelParamsFromPSF)pmModelParamsFromPSF_PS1_V1, (pmModelFitStatusFunc)pmModelFitStatus_PS1_V1, (pmModelSetLimitsFunc)pmModelSetLimits_PS1_V1 },
     60    {"PS_MODEL_RGAUSS",       8, 0, (pmModelFunc)pmModelFunc_RGAUSS,  (pmModelFlux)pmModelFlux_RGAUSS,  (pmModelRadius)pmModelRadius_RGAUSS,  (pmModelSetFWHM)pmModelSetFWHM_RGAUSS,  (pmModelLimits)pmModelLimits_RGAUSS,  (pmModelGuessFunc)pmModelGuess_RGAUSS, (pmModelFromPSFFunc)pmModelFromPSF_RGAUSS, (pmModelParamsFromPSF)pmModelParamsFromPSF_RGAUSS, (pmModelFitStatusFunc)pmModelFitStatus_RGAUSS, (pmModelSetLimitsFunc)pmModelSetLimits_RGAUSS },
     61    {"PS_MODEL_SERSIC",       8, 1, (pmModelFunc)pmModelFunc_SERSIC,  (pmModelFlux)pmModelFlux_SERSIC,  (pmModelRadius)pmModelRadius_SERSIC,  (pmModelSetFWHM)pmModelSetFWHM_SERSIC,  (pmModelLimits)pmModelLimits_SERSIC,  (pmModelGuessFunc)pmModelGuess_SERSIC, (pmModelFromPSFFunc)pmModelFromPSF_SERSIC, (pmModelParamsFromPSF)pmModelParamsFromPSF_SERSIC, (pmModelFitStatusFunc)pmModelFitStatus_SERSIC, (pmModelSetLimitsFunc)pmModelSetLimits_SERSIC },
     62    {"PS_MODEL_EXP",          7, 1, (pmModelFunc)pmModelFunc_EXP,     (pmModelFlux)pmModelFlux_EXP,     (pmModelRadius)pmModelRadius_EXP,     (pmModelSetFWHM)pmModelSetFWHM_EXP,     (pmModelLimits)pmModelLimits_EXP,     (pmModelGuessFunc)pmModelGuess_EXP,    (pmModelFromPSFFunc)pmModelFromPSF_EXP,    (pmModelParamsFromPSF)pmModelParamsFromPSF_EXP,    (pmModelFitStatusFunc)pmModelFitStatus_EXP,    (pmModelSetLimitsFunc)pmModelSetLimits_EXP    },
     63    {"PS_MODEL_DEV",          7, 1, (pmModelFunc)pmModelFunc_DEV,     (pmModelFlux)pmModelFlux_DEV,     (pmModelRadius)pmModelRadius_DEV,     (pmModelSetFWHM)pmModelSetFWHM_DEV,     (pmModelLimits)pmModelLimits_DEV,     (pmModelGuessFunc)pmModelGuess_DEV,    (pmModelFromPSFFunc)pmModelFromPSF_DEV,    (pmModelParamsFromPSF)pmModelParamsFromPSF_DEV,    (pmModelFitStatusFunc)pmModelFitStatus_DEV,    (pmModelSetLimitsFunc)pmModelSetLimits_DEV    },
     64    {"PS_MODEL_TRAIL",        7, 0, (pmModelFunc)pmModelFunc_TRAIL,   (pmModelFlux)pmModelFlux_TRAIL,   (pmModelRadius)pmModelRadius_TRAIL,   (pmModelSetFWHM)pmModelSetFWHM_TRAIL,   (pmModelLimits)pmModelLimits_TRAIL,   (pmModelGuessFunc)pmModelGuess_TRAIL,  (pmModelFromPSFFunc)pmModelFromPSF_TRAIL,  (pmModelParamsFromPSF)pmModelParamsFromPSF_TRAIL,  (pmModelFitStatusFunc)pmModelFitStatus_TRAIL,  (pmModelSetLimitsFunc)pmModelSetLimits_TRAIL  },
    6565};
    6666
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmModelClass.h

    r36441 r36884  
    3535    char *name;
    3636    int nParams;
     37    bool useReff;
    3738    pmModelFunc          modelFunc;
    3839    pmModelFlux          modelFlux;
    3940    pmModelRadius        modelRadius;
     41    pmModelSetFWHM       modelSetFWHM;
    4042    pmModelLimits        modelLimits;
    4143    pmModelGuessFunc     modelGuess;
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmModelFuncs.h

    r36375 r36884  
    110110typedef psF64 (*pmModelRadius)(const psVector *params, double flux);
    111111
     112// This function returns the FWHM given the supplied sigma (major or minor)
     113typedef psF64 (*pmModelSetFWHM)(const psVector *params, double sigma);
     114
    112115//  This function provides the model guess parameters based on the details of
    113116//  the given source.
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmModelUtils.c

    r36623 r36884  
    3232#include "pmMoments.h"
    3333#include "pmModelFuncs.h"
     34#include "pmModelClass.h"
    3435#include "pmModel.h"
    3536#include "pmModelUtils.h"
    36 #include "pmModelClass.h"
    3737#include "pmSourceMasks.h"
    3838#include "pmSourceExtendedPars.h"
     
    4646#include "pmErrorCodes.h"
    4747
    48 // XX static bool useModelVar = false;
    49 // XX
    50 // XX void pmModelSetModelVarOption (bool option) {
    51 // XX   useModelVar = option;
    52 // XX }
    53 // XX bool pmModelGetModelVarOption (void) {
    54 // XX   return useModelVar;
    55 // XX }
    56 
    5748/*****************************************************************************
    5849pmModelFromPSF (*modelEXT, *psf):  use the model position parameters to
     
    6859
    6960    // set model parameters for this source based on PSF information
    70     if (!modelEXT->modelFromPSF (modelPSF, modelEXT, psf)) {
     61    if (!modelEXT->class->modelFromPSF (modelPSF, modelEXT, psf)) {
    7162        psTrace ("psModules.objects", 3, "Failed to set model params from PSF");
    7263        psFree(modelPSF);
     
    8980
    9081    // set model parameters for this source based on PSF information
    91     if (!modelPSF->modelParamsFromPSF (modelPSF, psf, Xo, Yo, Io)) {
     82    if (!modelPSF->class->modelParamsFromPSF (modelPSF, psf, Xo, Yo, Io)) {
    9283        psFree(modelPSF);
    9384        return NULL;
     
    109100
    110101    // determine the normalized flux
    111     float normFlux = model->modelFlux (model->params);
     102    float normFlux = model->class->modelFlux (model->params);
    112103    assert (isfinite(normFlux));
    113104    assert (normFlux > 0);
     
    120111
    121112bool pmModelUseReff (pmModelType type) {
    122     bool useReff = false;
    123     useReff |= (type == pmModelClassGetType ("PS_MODEL_SERSIC"));
    124     useReff |= (type == pmModelClassGetType ("PS_MODEL_DEV"));
    125     useReff |= (type == pmModelClassGetType ("PS_MODEL_EXP"));
     113
     114    pmModelClass *class = pmModelClassSelect (type);
     115    psAssert (class, "undefined model class?");
     116    bool useReff = class->useReff;
    126117    return useReff;
    127118}
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmPCM_MinimizeChisq.c

    r36623 r36884  
    3131#include "pmMoments.h"
    3232#include "pmModelFuncs.h"
     33#include "pmModelClass.h"
    3334#include "pmModel.h"
    3435#include "pmModelUtils.h"
    35 #include "pmModelClass.h"
    3636#include "pmSourceMasks.h"
    3737#include "pmSourceExtendedPars.h"
     
    455455            coord->data.F32[1] = (psF32) (i + 0.5 + source->pixels->row0);
    456456
    457             pcm->modelFlux->data.F32[i][j] = pcm->modelConv->modelFunc (deriv, params, coord);
     457            pcm->modelFlux->data.F32[i][j] = pcm->modelConv->class->modelFunc (deriv, params, coord);
    458458
    459459            for (int n = 0; n < params->n; n++) {
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmPCMdata.c

    r36623 r36884  
    3131#include "pmMoments.h"
    3232#include "pmModelFuncs.h"
     33#include "pmModelClass.h"
    3334#include "pmModel.h"
    3435#include "pmModelUtils.h"
    35 #include "pmModelClass.h"
    3636#include "pmSourceMasks.h"
    3737#include "pmSourceExtendedPars.h"
     
    293293   
    294294    psEllipseAxes axes;
    295     bool useReff = pmModelUseReff (modelPSF->type);
     295    bool useReff = modelPSF->class->useReff;
    296296    psF32 *PAR = modelPSF->params->data.F32;
    297297    pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], useReff);
     
    302302    // XXX need to do this more carefully
    303303    if (modelPSF->type == modelType_GAUSS) {
    304         float FWHM_MAJOR = 2*modelPSF->modelRadius (modelPSF->params, 0.5*PAR[PM_PAR_I0]);
     304        float FWHM_MAJOR = 2*modelPSF->class->modelRadius (modelPSF->params, 0.5*PAR[PM_PAR_I0]);
    305305        float FWHM_MINOR = FWHM_MAJOR * (axes.minor / axes.major);
    306306        *sigma = 0.50 * (FWHM_MAJOR + FWHM_MINOR) / 2.35;
     
    330330   
    331331    psEllipseAxes axes;
    332     bool useReff = pmModelUseReff (modelPSF->type);
     332    bool useReff = modelPSF->class->useReff;
    333333    psF32 *PAR = modelPSF->params->data.F32;
    334334    pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], useReff);
     
    339339    // XXX need to do this more carefully
    340340    if (modelPSF->type == modelType_GAUSS) {
    341         float FWHM_MAJOR = 2*modelPSF->modelRadius (modelPSF->params, 0.5*PAR[PM_PAR_I0]);
     341        float FWHM_MAJOR = 2*modelPSF->class->modelRadius (modelPSF->params, 0.5*PAR[PM_PAR_I0]);
    342342        float FWHM_MINOR = FWHM_MAJOR * (axes.minor / axes.major);
    343343        *sigma = 0.50 * (FWHM_MAJOR + FWHM_MINOR) / 2.35;
     
    393393    psMinConstraint *constraint = psMinConstraintAlloc();
    394394    constraint->paramMask = psVectorAlloc (params->n, PS_TYPE_VECTOR_MASK);
    395     constraint->checkLimits = model->modelLimits;
     395    constraint->checkLimits = model->class->modelLimits;
    396396
    397397    int nParams = pmPCMsetParams (constraint, fitOptions->mode);
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmPSF.c

    r36623 r36884  
    3737#include "pmMoments.h"
    3838#include "pmModelFuncs.h"
     39#include "pmModelClass.h"
    3940#include "pmModel.h"
    4041#include "pmModelUtils.h"
    41 #include "pmModelClass.h"
    4242#include "pmSourceMasks.h"
    4343#include "pmSourceExtendedPars.h"
     
    329329// convert the parameters used in the fitted source model to the psEllipseAxes representation
    330330// (major,minor,theta)
    331 psEllipseAxes pmPSF_ModelToAxes (psF32 *modelPar, pmModelType type)
     331psEllipseAxes pmPSF_ModelToAxes (psF32 *modelPar, bool useReff)
    332332{
    333333    psEllipseAxes axes;
     
    338338    PS_ASSERT_PTR_NON_NULL(modelPar, axes);
    339339
    340     bool useReff = pmModelUseReff (type);
    341340    pmModelParamsToAxes (&axes, modelPar[PM_PAR_SXX], modelPar[PM_PAR_SXY], modelPar[PM_PAR_SYY], useReff);
    342341    return axes;
     
    345344// convert the psEllipseAxes representation (major,minor,theta) to the parameters used in the
    346345// fitted source model
    347 bool pmPSF_AxesToModel (psF32 *modelPar, psEllipseAxes axes, pmModelType type)
     346bool pmPSF_AxesToModel (psF32 *modelPar, psEllipseAxes axes, bool useReff)
    348347{
    349348    PS_ASSERT_PTR_NON_NULL(modelPar, false);
     
    357356    }
    358357   
    359     bool useReff = pmModelUseReff (type);
    360358    pmModelAxesToParams (&modelPar[PM_PAR_SXX], &modelPar[PM_PAR_SXY], &modelPar[PM_PAR_SYY], axes, useReff);
    361359    return true;
     
    420418
    421419    // get the model full-width at half-max
    422     float fwhmMajor = 2*model->modelRadius (model->params, 0.5);
     420    float fwhmMajor = 2*model->class->modelRadius (model->params, 0.5);
    423421
    424422# if (0)
    425423    psF32 *params = model->params->data.F32; // Model parameters
    426     psEllipseAxes axes = pmPSF_ModelToAxes(params, MAX_AXIS_RATIO, model->type); // Ellipse axes
     424    psEllipseAxes axes = pmPSF_ModelToAxes(params, MAX_AXIS_RATIO, model->class->useReff); // Ellipse axes
    427425
    428426    // Curiously, the minor axis can be larger than the major axis, so need to check.
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmPSF.h

    r35768 r36884  
    106106pmPSF *pmPSFBuildSimple (char *typeName, float sxx, float syy, float sxy, ...);
    107107
    108 bool pmPSF_AxesToModel (psF32 *modelPar, psEllipseAxes axes, pmModelType type);
     108bool pmPSF_AxesToModel (psF32 *modelPar, psEllipseAxes axes, bool useReff);
    109109bool pmPSF_FitToModel (psF32 *fittedPar, float minMinorAxis, bool useReff);
    110110
    111111psEllipsePol pmPSF_ModelToFit (psF32 *modelPar, bool useReff);
    112 psEllipseAxes pmPSF_ModelToAxes (psF32 *modelPar, pmModelType type);
     112psEllipseAxes pmPSF_ModelToAxes (psF32 *modelPar, bool useReff);
    113113
    114114/// Calculate FWHM value from a PSF
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmPSF_IO.c

    r36623 r36884  
    4747#include "pmMoments.h"
    4848#include "pmModelFuncs.h"
     49#include "pmModelClass.h"
    4950#include "pmModel.h"
    5051#include "pmModelUtils.h"
    51 #include "pmModelClass.h"
    5252#include "pmSourceMasks.h"
    5353#include "pmSourceExtendedPars.h"
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmPSFtry.c

    r36623 r36884  
    2929#include "pmMoments.h"
    3030#include "pmModelFuncs.h"
     31#include "pmModelClass.h"
    3132#include "pmModel.h"
    3233#include "pmModelUtils.h"
    33 #include "pmModelClass.h"
    3434#include "pmSourceMasks.h"
    3535#include "pmSourceExtendedPars.h"
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmPSFtryFitEXT.c

    r36623 r36884  
    2929#include "pmMoments.h"
    3030#include "pmModelFuncs.h"
     31#include "pmModelClass.h"
    3132#include "pmModel.h"
    3233#include "pmModelUtils.h"
    33 #include "pmModelClass.h"
    3434#include "pmSourceMasks.h"
    3535#include "pmSourceExtendedPars.h"
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmPSFtryFitPSF.c

    r36658 r36884  
    2727#include "pmMoments.h"
    2828#include "pmModelFuncs.h"
     29#include "pmModelClass.h"
    2930#include "pmModel.h"
    3031#include "pmModelUtils.h"
    31 #include "pmModelClass.h"
    3232#include "pmSourceMasks.h"
    3333#include "pmSourceExtendedPars.h"
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmPSFtryMakePSF.c

    r36834 r36884  
    2828#include "pmMoments.h"
    2929#include "pmModelFuncs.h"
     30#include "pmModelClass.h"
    3031#include "pmModel.h"
    3132#include "pmModelUtils.h"
    32 #include "pmModelClass.h"
    3333#include "pmSourceMasks.h"
    3434#include "pmSourceExtendedPars.h"
     
    212212        assert (source->modelEXT); // all unmasked sources should have modelEXT
    213213
    214         bool useReff = pmModelUseReff (source->modelEXT->type);
     214        bool useReff = source->modelEXT->class->useReff;
    215215        psEllipsePol pol = pmPSF_ModelToFit (source->modelEXT->params->data.F32, useReff);
    216216
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmPSFtryMetric.c

    r36623 r36884  
    2828#include "pmMoments.h"
    2929#include "pmModelFuncs.h"
     30#include "pmModelClass.h"
    3031#include "pmModel.h"
    3132#include "pmModelUtils.h"
    32 #include "pmModelClass.h"
    3333#include "pmSourceMasks.h"
    3434#include "pmSourceExtendedPars.h"
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmPSFtryModel.c

    r36623 r36884  
    2929#include "pmMoments.h"
    3030#include "pmModelFuncs.h"
     31#include "pmModelClass.h"
    3132#include "pmModel.h"
    3233#include "pmModelUtils.h"
    33 #include "pmModelClass.h"
    3434#include "pmSourceMasks.h"
    3535#include "pmSourceExtendedPars.h"
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmPhotObj.c

    r36623 r36884  
    2929#include "pmMoments.h"
    3030#include "pmModelFuncs.h"
     31#include "pmModelClass.h"
    3132#include "pmModel.h"
    3233#include "pmModelUtils.h"
    33 #include "pmModelClass.h"
    3434#include "pmSourceMasks.h"
    3535#include "pmSourceExtendedPars.h"
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmSource.c

    r36747 r36884  
    3333#include "pmMoments.h"
    3434#include "pmModelFuncs.h"
     35#include "pmModelClass.h"
    3536#include "pmModel.h"
    3637#include "pmModelUtils.h"
    37 #include "pmModelClass.h"
    3838#include "pmSourceMasks.h"
    3939#include "pmSourceExtendedPars.h"
     
    146146    source->apMagRaw         = NAN;
    147147    source->apRadius         = NAN;
     148    source->apNpixels        = 0;
    148149    source->apFlux           = NAN;
    149150    source->apFluxErr        = NAN;
     
    237238    source->apMagRaw         = in->apMagRaw;
    238239    source->apRadius         = in->apRadius;
     240    source->apNpixels        = in->apNpixels;
    239241    source->apFlux           = in->apFlux;
    240242    source->apFluxErr        = in->apFluxErr;
     
    987989    if (!isfinite(oldI0)) return false;
    988990
    989     bool useReff = pmModelUseReff (model->type);
     991    bool useReff = model->class->useReff;
    990992    pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], useReff);
    991993
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmSource.h

    r36747 r36884  
    9797    float apMagRaw;                     ///< raw mag in given aperture
    9898    float apRadius;                     ///< radius for aperture magnitude
     99    int   apNpixels;                    ///< number of unmasked pixels in aperture
    99100    float apFlux;                       ///< apFlux corresponding to psfMag or extMag (depending on type)
    100101    float apFluxErr;                    ///< apFluxErr corresponding to psfMag or extMag (depending on type)
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmSourceContour.c

    r36623 r36884  
    3333#include "pmMoments.h"
    3434#include "pmModelFuncs.h"
     35#include "pmModelClass.h"
    3536#include "pmModel.h"
    3637#include "pmModelUtils.h"
    37 #include "pmModelClass.h"
    3838#include "pmSourceMasks.h"
    3939#include "pmSourceExtendedPars.h"
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmSourceFitModel.c

    r36623 r36884  
    3333#include "pmMoments.h"
    3434#include "pmModelFuncs.h"
     35#include "pmModelClass.h"
    3536#include "pmModel.h"
    3637#include "pmModelUtils.h"
    37 #include "pmModelClass.h"
    3838#include "pmSourceMasks.h"
    3939#include "pmSourceExtendedPars.h"
     
    170170    psMinConstraint *constraint = psMinConstraintAlloc();
    171171    constraint->paramMask = psVectorAlloc (params->n, PS_TYPE_VECTOR_MASK);
    172     constraint->checkLimits = model->modelLimits;
     172    constraint->checkLimits = model->class->modelLimits;
    173173
    174174    // set parameter mask based on fitting mode
     
    233233    // force the floating parameters to fall within the contraint ranges
    234234    for (int i = 0; i < params->n; i++) {
    235         model->modelLimits (PS_MINIMIZE_PARAM_MIN, i, params->data.F32, NULL);
    236         model->modelLimits (PS_MINIMIZE_PARAM_MAX, i, params->data.F32, NULL);
     235        model->class->modelLimits (PS_MINIMIZE_PARAM_MIN, i, params->data.F32, NULL);
     236        model->class->modelLimits (PS_MINIMIZE_PARAM_MAX, i, params->data.F32, NULL);
    237237    }
    238238
     
    254254    psImage *covar = psImageAlloc (params->n, params->n, PS_TYPE_F32);
    255255
    256     fitStatus = psMinimizeLMChi2(myMin, covar, params, constraint, x, y, yErr, model->modelFunc);
     256    fitStatus = psMinimizeLMChi2(myMin, covar, params, constraint, x, y, yErr, model->class->modelFunc);
    257257    for (int i = 0; i < dparams->n; i++) {
    258258        if ((constraint->paramMask != NULL) && constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[i])
     
    306306            altmask->data.PS_TYPE_VECTOR_MASK_DATA[i] = (constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[i]) ? 0 : 1;
    307307        }
    308         psMinimizeGaussNewtonDelta(delta, params, altmask, x, y, yErr, model->modelFunc);
     308        psMinimizeGaussNewtonDelta(delta, params, altmask, x, y, yErr, model->class->modelFunc);
    309309
    310310        for (int i = 0; i < dparams->n; i++) {
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmSourceFitPCM.c

    r36623 r36884  
    3131#include "pmMoments.h"
    3232#include "pmModelFuncs.h"
     33#include "pmModelClass.h"
    3334#include "pmModel.h"
    3435#include "pmModelUtils.h"
    35 #include "pmModelClass.h"
    3636#include "pmSourceMasks.h"
    3737#include "pmSourceExtendedPars.h"
     
    6363    // force the floating parameters to fall within the contraint ranges
    6464    for (int i = 0; i < params->n; i++) {
    65         pcm->modelConv->modelLimits (PS_MINIMIZE_PARAM_MIN, i, params->data.F32, NULL);
    66         pcm->modelConv->modelLimits (PS_MINIMIZE_PARAM_MAX, i, params->data.F32, NULL);
     65        pcm->modelConv->class->modelLimits (PS_MINIMIZE_PARAM_MIN, i, params->data.F32, NULL);
     66        pcm->modelConv->class->modelLimits (PS_MINIMIZE_PARAM_MAX, i, params->data.F32, NULL);
    6767    }
    6868
     
    165165bool pmSourceModelGuessPCM (pmPCMdata *pcm, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal) {
    166166
    167     if (!pcm->modelConv->modelGuess(pcm->modelConv, source, maskVal, markVal)) {
     167    if (!pcm->modelConv->class->modelGuess(pcm->modelConv, source, maskVal, markVal)) {
    168168        return false;
    169169    }
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmSourceFitSet.c

    r36623 r36884  
    3232#include "pmMoments.h"
    3333#include "pmModelFuncs.h"
     34#include "pmModelClass.h"
    3435#include "pmModel.h"
    3536#include "pmModelUtils.h"
    36 #include "pmModelClass.h"
    3737#include "pmSourceMasks.h"
    3838#include "pmSourceExtendedPars.h"
     
    223223    float *paramOne = params + nParamBase;
    224224    float *betaOne = betas + nParamBase;
    225     bool status = model->modelLimits (mode, nParamOne, paramOne, betaOne);
     225    bool status = model->class->modelLimits (mode, nParamOne, paramOne, betaOne);
    226226    return status;
    227227}
     
    388388        psVector *derivOne = thisSet->derivSet->data[i];
    389389
    390         chisqOne = model->modelFunc (derivOne, paramOne, x);
     390        chisqOne = model->class->modelFunc (derivOne, paramOne, x);
    391391        chisqSum += chisqOne;
    392392    }
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmSourceGroups.c

    r36623 r36884  
    1818#include "pmMoments.h"
    1919#include "pmModelFuncs.h"
     20#include "pmModelClass.h"
    2021#include "pmModel.h"
    2122#include "pmModelUtils.h"
    22 #include "pmModelClass.h"
    2323#include "pmSourceMasks.h"
    2424#include "pmSourceExtendedPars.h"
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmSourceIO.c

    r36757 r36884  
    4040#include "pmMoments.h"
    4141#include "pmModelFuncs.h"
     42#include "pmModelClass.h"
    4243#include "pmModel.h"
    4344#include "pmModelUtils.h"
    44 #include "pmModelClass.h"
    4545#include "pmSourceMasks.h"
    4646#include "pmSourceExtendedPars.h"
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmSourceIO_CFF.c

    r36757 r36884  
    3737#include "pmMoments.h"
    3838#include "pmModelFuncs.h"
     39#include "pmModelClass.h"
    3940#include "pmModel.h"
    4041#include "pmModelUtils.h"
    41 #include "pmModelClass.h"
    4242#include "pmSourceMasks.h"
    4343#include "pmSourceExtendedPars.h"
     
    208208            axes.minor        = 1.0;
    209209            axes.theta        = 0.0;
    210             pmPSF_AxesToModel (PAR, axes, modelType);
     210            pmPSF_AxesToModel (PAR, axes, model->class->useReff);
    211211
    212212            // peak->detValue, rawFlux, smoothFlux are all set to the flux argument which is counts per second
     
    273273            galaxyAxes.theta = theta * PS_RAD_DEG;
    274274
    275             pmPSF_AxesToModel (xPAR, galaxyAxes, galaxyModelType);
     275            pmPSF_AxesToModel (xPAR, galaxyAxes, model->class->useReff);
    276276            if (model->params->n > 7) {
    277277                xPAR[PM_PAR_7] = 0.5 / Sindex;
     
    403403                        yPos[n_rows] = PAR[PM_PAR_YPOS];
    404404
    405                         psEllipseAxes axes = pmPSF_ModelToAxes (PAR, model->type);
     405                        psEllipseAxes axes = pmPSF_ModelToAxes (PAR, model->class->useReff);
    406406                        rMajor[n_rows] = axes.major;
    407407                        rMinor[n_rows] = axes.minor;
     
    461461                        yPos[0] = PAR[PM_PAR_YPOS];
    462462
    463                         psEllipseAxes axes = pmPSF_ModelToAxes (PAR, model->type);
     463                        psEllipseAxes axes = pmPSF_ModelToAxes (PAR, model->class->useReff);
    464464                        rMajor[0] = axes.major;
    465465                        rMinor[0] = axes.minor;
     
    490490                                yPos[1] = PAR[PM_PAR_YPOS];
    491491
    492                                 psEllipseAxes axes = pmPSF_ModelToAxes (PAR, model->type);
     492                                psEllipseAxes axes = pmPSF_ModelToAxes (PAR, model->class->useReff);
    493493                                rMajor[1] = axes.major;
    494494                                rMinor[1] = axes.minor;
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmSourceIO_CMF.c.in

    r36758 r36884  
    3737#include "pmMoments.h"
    3838#include "pmModelFuncs.h"
     39#include "pmModelClass.h"
    3940#include "pmModel.h"
    4041#include "pmModelUtils.h"
    41 #include "pmModelClass.h"
    4242#include "pmSourceMasks.h"
    4343#include "pmSourceExtendedPars.h"
     
    142142        @ALL@                       psMetadataAdd (row, PS_LIST_TAIL, "AP_MAG",           PS_DATA_F32, "magnitude in standard aperture",             source->apMag);
    143143        @>PS1_V2,PS1_SV?,>PS1_DV1@  psMetadataAdd (row, PS_LIST_TAIL, "AP_MAG_RAW",       PS_DATA_F32, "magnitude in reported aperture",             source->apMagRaw);
    144         @ALL@                       psMetadataAdd (row, PS_LIST_TAIL, "AP_MAG_RADIUS",    PS_DATA_F32, "radius used for aperture mags",              outputs.apRadius);
     144        @ALL@                       psMetadataAdd (row, PS_LIST_TAIL, "AP_MAG_RADIUS",    PS_DATA_F32, "radius used for aperture mags",              source->apRadius);
    145145        @>PS1_DV1,>PS1_V3,>PS1_SV1@ psMetadataAdd (row, PS_LIST_TAIL, "AP_FLUX",          PS_DATA_F32, "instrumental flux in standard aperture",     source->apFlux);
    146146        @>PS1_DV1,>PS1_V3,>PS1_SV1@ psMetadataAdd (row, PS_LIST_TAIL, "AP_FLUX_SIG",      PS_DATA_F32, "aperture flux error",                        source->apFluxErr);
     147        @>PS1_V4,>PS1_SV2,>PS1_DV3@ psMetadataAdd (row, PS_LIST_TAIL, "AP_NPIX",          PS_DATA_S32, "aperture unmasked pixels",                   source->apNpixels);
    147148
    148149        @<PS1_V3,PS1_SV1,PS1_DV?@ psMetadataAdd (row, PS_LIST_TAIL, "PEAK_FLUX_AS_MAG", PS_DATA_F32, "Peak flux expressed as magnitude",           outputs.peakMag);
     
    163164        @ALL@                     psMetadataAdd (row, PS_LIST_TAIL, "EXT_NSIGMA",       PS_DATA_F32, "Nsigma deviations from PSF to EXT",          source->extNsigma);
    164165
     166        // PSF shape parameters:
    165167        @ALL@                     psMetadataAdd (row, PS_LIST_TAIL, "PSF_MAJOR",        PS_DATA_F32, "PSF width (major axis)",                     outputs.psfMajor);
    166168        @ALL@                     psMetadataAdd (row, PS_LIST_TAIL, "PSF_MINOR",        PS_DATA_F32, "PSF width (minor axis)",                     outputs.psfMinor);
    167169        @ALL@                     psMetadataAdd (row, PS_LIST_TAIL, "PSF_THETA",        PS_DATA_F32, "PSF orientation angle",                      outputs.psfTheta);
     170        @>PS1_V4,>PS1_SV2,>PS1_DV3@ psMetadataAdd (row, PS_LIST_TAIL, "PSF_CORE",         PS_DATA_F32, "k term if defined",                          outputs.psfCore);
     171
     172        // I use a look-up table and linear interpolation to map PSF_MAJOR,PSF_MINOR + PSF_CORE to FWHM values
     173        @>PS1_V4,>PS1_SV2,>PS1_DV3@ psMetadataAdd (row, PS_LIST_TAIL, "PSF_FWHM_MAJ",        PS_DATA_F32, "PSF FWHM (major axis)",                   outputs.psfMajorFWHM);
     174        @>PS1_V4,>PS1_SV2,>PS1_DV3@ psMetadataAdd (row, PS_LIST_TAIL, "PSF_FWHM_MIN",        PS_DATA_F32, "PSF FWHM (minor axis)",                   outputs.psfMinorFWHM);
     175
     176        // psf data quality
    168177        @ALL@                     psMetadataAdd (row, PS_LIST_TAIL, "PSF_QF",           PS_DATA_F32, "PSF coverage/quality factor (bad)",          source->pixWeightNotBad);
    169178        @>PS1_V2,PS1_SV?,>PS1_DV1@ psMetadataAdd (row, PS_LIST_TAIL, "PSF_QF_PERFECT",   PS_DATA_F32, "PSF coverage/quality factor (poor)",         source->pixWeightNotPoor);
     
    197206        }
    198207
    199         if (source->lensingOBJ && source->lensingPSF->smear) {
     208        if (source->lensingPSF && source->lensingPSF->smear) {
    200209          @>PS1_V4@               psMetadataAdd (row, PS_LIST_TAIL, "LENS_X11_SM_PSF",  PS_DATA_F32, "smear polarizability element (objects)",     source->lensingPSF->smear->X11);
    201210          @>PS1_V4@               psMetadataAdd (row, PS_LIST_TAIL, "LENS_X12_SM_PSF",  PS_DATA_F32, "smear polarizability element (objects)",     source->lensingPSF->smear->X12);
     
    205214        }
    206215
    207         if (source->lensingOBJ && source->lensingPSF->shear) {
     216        if (source->lensingPSF && source->lensingPSF->shear) {
    208217          @>PS1_V4@               psMetadataAdd (row, PS_LIST_TAIL, "LENS_X11_SH_PSF",  PS_DATA_F32, "shear polarizability element (objects)",     source->lensingPSF->shear->X11);
    209218          @>PS1_V4@               psMetadataAdd (row, PS_LIST_TAIL, "LENS_X12_SH_PSF",  PS_DATA_F32, "shear polarizability element (objects)",     source->lensingPSF->shear->X12);
     
    302311
    303312    // define PSF model type
    304     // XXX need to carry the extra model parameters
    305313    int modelType = pmModelClassGetType ("PS_MODEL_GAUSS");
    306314
    307     char *PSF_NAME = psMetadataLookupStr (&status, header, "PSF_NAME");
     315    // if header does not define the model, default to a gaussian
     316    char *PSF_NAME = psMetadataLookupStr (&status, header, "PSFMODEL");
    308317    if (PSF_NAME != NULL) {
    309318        modelType = pmModelClassGetType (PSF_NAME);
    310319    }
    311320    assert (modelType > -1);
     321
     322    // do we expect to find lensing parameters?
     323    bool haveLensOBJ = psMetadataLookupBool (&status, header, "LENS_OBJ");
     324    bool haveLensPSF = psMetadataLookupBool (&status, header, "LENS_PSF");
    312325
    313326    // We get the size of the table, and allocate the array of sources first because the table
     
    344357        @ALL@     axes.theta        = psMetadataLookupF32 (&status, row, "PSF_THETA");
    345358        @ALL@     axes.theta        = axes.theta * PS_RAD_DEG;
     359       
     360        @>PS1_V4,>PS1_SV2,>PS1_DV3@ if (model->params->n >= PM_PAR_7) {
     361        @>PS1_V4,>PS1_SV2,>PS1_DV3@     PAR[PM_PAR_7] = psMetadataLookupF32 (&status, row, "PSF_CORE");
     362        @>PS1_V4,>PS1_SV2,>PS1_DV3@ }
    346363
    347364        @ALL@     PAR[PM_PAR_SKY]   = psMetadataLookupF32 (&status, row, "SKY");
     
    355372        @ALL@     source->apMag     = psMetadataLookupF32 (&status, row, "AP_MAG");
    356373        @>PS1_V2,PS1_SV?,>PS1_DV1@ source->apMagRaw  = psMetadataLookupF32 (&status, row, "AP_MAG_RAW");
     374        @>PS1_DV1,>PS1_V3,>PS1_SV1@ source->apFlux = psMetadataLookupF32 (&status, row, "AP_FLUX");
     375        @>PS1_DV1,>PS1_V3,>PS1_SV1@ source->apFluxErr = psMetadataLookupF32 (&status, row, "AP_FLUX_SIG");
    357376
    358377        // XXX use these to determine PAR[PM_PAR_I0] if they exist?
     
    365384        @ALL@     dPAR[PM_PAR_I0]   = (isfinite(source->psfMag)) ? PAR[PM_PAR_I0] * source->psfMagErr : NAN;
    366385
    367         pmPSF_AxesToModel (PAR, axes, modelType);
     386        pmPSF_AxesToModel (PAR, axes, model->class->useReff);
    368387
    369388        @ALL@     float peakMag     = psMetadataLookupF32 (&status, row, "PEAK_FLUX_AS_MAG");
     
    383402        @ALL@     source->crNsigma  = psMetadataLookupF32 (&status, row, "CR_NSIGMA");
    384403        @ALL@     source->extNsigma = psMetadataLookupF32 (&status, row, "EXT_NSIGMA");
    385         @ALL@     source->apRadius  = psMetadataLookupS32 (&status, row, "AP_MAG_RADIUS");
     404        @ALL@     source->apRadius  = psMetadataLookupF32 (&status, row, "AP_MAG_RADIUS");
     405        @>PS1_V4,>PS1_SV2,>PS1_DV3@ source->apNpixels = psMetadataLookupS32 (&status, row, "AP_NPIX");
    386406
    387407        // note that some older versions used PSF_PROBABILITY: this was not well defined.
     
    410430        @>PS1_V2,PS1_SV?@ source->moments->Mxyyy = -0.25 * psMetadataLookupF32 (&status, row, "MOMENTS_M4S");
    411431        @>PS1_V2,PS1_SV?@ source->moments->Myyyy = 0.0;
     432
     433        // Lensing parameters (on read if PS1_V5+)
     434        if (haveLensOBJ) {
     435          source->lensingOBJ = pmSourceLensingAlloc ();
     436          source->lensingOBJ->smear = pmLensingParsAlloc();
     437          source->lensingOBJ->shear = pmLensingParsAlloc();
     438
     439          @>PS1_V4@ source->lensingOBJ->smear->X11 = psMetadataLookupF32 (&status, row, "LENS_X11_SM_OBJ");
     440          @>PS1_V4@ source->lensingOBJ->smear->X12 = psMetadataLookupF32 (&status, row, "LENS_X12_SM_OBJ");
     441          @>PS1_V4@ source->lensingOBJ->smear->X22 = psMetadataLookupF32 (&status, row, "LENS_X22_SM_OBJ");
     442          @>PS1_V4@ source->lensingOBJ->smear->e1  = psMetadataLookupF32 (&status, row, "LENS_E1_SM_OBJ");
     443          @>PS1_V4@ source->lensingOBJ->smear->e2  = psMetadataLookupF32 (&status, row, "LENS_E2_SM_OBJ");
     444          @>PS1_V4@ source->lensingOBJ->shear->X11 = psMetadataLookupF32 (&status, row, "LENS_X11_SH_OBJ");
     445          @>PS1_V4@ source->lensingOBJ->shear->X12 = psMetadataLookupF32 (&status, row, "LENS_X12_SH_OBJ");
     446          @>PS1_V4@ source->lensingOBJ->shear->X22 = psMetadataLookupF32 (&status, row, "LENS_X22_SH_OBJ");
     447          @>PS1_V4@ source->lensingOBJ->shear->e1  = psMetadataLookupF32 (&status, row, "LENS_E1_SH_OBJ");
     448          @>PS1_V4@ source->lensingOBJ->shear->e2  = psMetadataLookupF32 (&status, row, "LENS_E2_SH_OBJ");
     449        }
     450
     451        if (haveLensPSF) {
     452          source->lensingPSF = pmSourceLensingAlloc ();
     453          source->lensingPSF->smear = pmLensingParsAlloc();
     454          source->lensingPSF->shear = pmLensingParsAlloc();
     455
     456          @>PS1_V4@ source->lensingPSF->smear->X11 = psMetadataLookupF32 (&status, row, "LENS_X11_SM_PSF");
     457          @>PS1_V4@ source->lensingPSF->smear->X12 = psMetadataLookupF32 (&status, row, "LENS_X12_SM_PSF");
     458          @>PS1_V4@ source->lensingPSF->smear->X22 = psMetadataLookupF32 (&status, row, "LENS_X22_SM_PSF");
     459          @>PS1_V4@ source->lensingPSF->smear->e1  = psMetadataLookupF32 (&status, row, "LENS_E1_SM_PSF");
     460          @>PS1_V4@ source->lensingPSF->smear->e2  = psMetadataLookupF32 (&status, row, "LENS_E2_SM_PSF");
     461          @>PS1_V4@ source->lensingPSF->shear->X11 = psMetadataLookupF32 (&status, row, "LENS_X11_SH_PSF");
     462          @>PS1_V4@ source->lensingPSF->shear->X12 = psMetadataLookupF32 (&status, row, "LENS_X12_SH_PSF");
     463          @>PS1_V4@ source->lensingPSF->shear->X22 = psMetadataLookupF32 (&status, row, "LENS_X22_SH_PSF");
     464          @>PS1_V4@ source->lensingPSF->shear->e1  = psMetadataLookupF32 (&status, row, "LENS_E1_SH_PSF");
     465          @>PS1_V4@ source->lensingPSF->shear->e2  = psMetadataLookupF32 (&status, row, "LENS_E2_SH_PSF");
     466        }
    412467
    413468        @>PS1_V2,PS1_SV?,>PS1_DV1@ source->moments->Mrf         = psMetadataLookupF32 (&status, row, "MOMENTS_R1");
     
    9821037                    psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_THETA_ERR",     0, "EXT angle err (SXY, isnan)", dPAR[PM_PAR_SXY]);
    9831038                } else {
    984                     psEllipseAxes axes = pmPSF_ModelToAxes (PAR, model->type);
     1039                    psEllipseAxes axes = pmPSF_ModelToAxes (PAR, model->class->useReff);
    9851040                    psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_WIDTH_MAJ",    0, "EXT width (major axis), length for trail", axes.major);
    9861041                    psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_WIDTH_MIN",    0, "EXT width (minor axis), sigma for trail",  axes.minor);
     
    11321187        axes.minor = psMetadataLookupF32(&status, row, "EXT_WIDTH_MIN");
    11331188        axes.theta = psMetadataLookupF32(&status, row, "EXT_THETA");
    1134         if (!pmPSF_AxesToModel(PAR, axes, modelType)) {
     1189        if (!pmPSF_AxesToModel(PAR, axes, model->class->useReff)) {
    11351190            // Do we need to fail here or can this happen?
    11361191            psError(PS_ERR_UNKNOWN, false, "Failed to convert psf axes to model");
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmSourceIO_CMP.c

    r36623 r36884  
    3737#include "pmMoments.h"
    3838#include "pmModelFuncs.h"
     39#include "pmModelClass.h"
    3940#include "pmModel.h"
    4041#include "pmModelUtils.h"
    41 #include "pmModelClass.h"
    4242#include "pmSourceMasks.h"
    4343#include "pmSourceExtendedPars.h"
     
    136136        lsky = (source->sky < 1.0) ? 0.0 : log10(source->sky);
    137137
    138         axes = pmPSF_ModelToAxes (PAR, model->type);
     138        axes = pmPSF_ModelToAxes (PAR, model->class->useReff);
    139139
    140140        float psfMagErr = isfinite(source->psfMagErr) ? source->psfMagErr : 999;
     
    293293                goto skip_source;
    294294
    295             pmPSF_AxesToModel (PAR, axes, modelType);
     295            pmPSF_AxesToModel (PAR, axes, source->modelPSF->class->useReff);
    296296
    297297            psArrayAdd (sources, 100, source);
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmSourceIO_MatchedRefs.c

    r36834 r36884  
    3737#include "pmMoments.h"
    3838#include "pmModelFuncs.h"
     39#include "pmModelClass.h"
    3940#include "pmModel.h"
    4041#include "pmModelUtils.h"
    41 #include "pmModelClass.h"
    4242#include "pmSourceMasks.h"
    4343#include "pmSourceExtendedPars.h"
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmSourceIO_OBJ.c

    r36623 r36884  
    3737#include "pmMoments.h"
    3838#include "pmModelFuncs.h"
     39#include "pmModelClass.h"
    3940#include "pmModel.h"
    4041#include "pmModelUtils.h"
    41 #include "pmModelClass.h"
    4242#include "pmSourceMasks.h"
    4343#include "pmSourceExtendedPars.h"
     
    9393        }
    9494
    95         axes = pmPSF_ModelToAxes (PAR, model->type);
     95        axes = pmPSF_ModelToAxes (PAR, model->class->useReff);
    9696
    9797        psLineInit (line);
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmSourceIO_PS1_CAL_0.c

    r36623 r36884  
    3737#include "pmMoments.h"
    3838#include "pmModelFuncs.h"
     39#include "pmModelClass.h"
    3940#include "pmModel.h"
    4041#include "pmModelUtils.h"
    41 #include "pmModelClass.h"
    4242#include "pmSourceMasks.h"
    4343#include "pmSourceExtendedPars.h"
     
    115115            yErr = dPAR[PM_PAR_YPOS];
    116116            if (isfinite(PAR[PM_PAR_SXX]) && isfinite(PAR[PM_PAR_SXX]) && isfinite(PAR[PM_PAR_SXX])) {
    117                 axes = pmPSF_ModelToAxes (PAR, model->type);
     117                axes = pmPSF_ModelToAxes (PAR, model->class->useReff);
    118118            } else {
    119119                axes.major = NAN;
     
    290290        dPAR[PM_PAR_I0]   = (isfinite(source->psfMag)) ? PAR[PM_PAR_I0] * source->psfMagErr : NAN;
    291291
    292         pmPSF_AxesToModel (PAR, axes, modelType);
     292        pmPSF_AxesToModel (PAR, axes, model->class->useReff);
    293293
    294294        float peakMag     = psMetadataLookupF32 (&status, row, "PEAK_FLUX_AS_MAG");
     
    624624            yErr = dPAR[PM_PAR_YPOS];
    625625
    626             axes = pmPSF_ModelToAxes (PAR, model->type);
     626            axes = pmPSF_ModelToAxes (PAR, model->class->useReff);
    627627
    628628            // generate RA,DEC
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmSourceIO_PS1_DEV_0.c

    r36623 r36884  
    3737#include "pmMoments.h"
    3838#include "pmModelFuncs.h"
     39#include "pmModelClass.h"
    3940#include "pmModel.h"
    4041#include "pmModelUtils.h"
    41 #include "pmModelClass.h"
    4242#include "pmSourceMasks.h"
    4343#include "pmSourceExtendedPars.h"
     
    9191            yErr = dPAR[PM_PAR_YPOS];
    9292
    93             axes = pmPSF_ModelToAxes (PAR, model->type);
     93            axes = pmPSF_ModelToAxes (PAR, model->class->useReff);
    9494        } else {
    9595            // XXX: This code seg faults if source->peak is NULL.
     
    216216        source->psfMagErr    = psMetadataLookupF32 (&status, row, "PSF_INST_MAG_SIG");
    217217
    218         pmPSF_AxesToModel (PAR, axes, modelType);
     218        pmPSF_AxesToModel (PAR, axes, model->class->useReff);
    219219
    220220        float peakMag = psMetadataLookupF32 (&status, row, "PEAK_FLUX_AS_MAG");
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmSourceIO_PS1_DEV_1.c

    r36623 r36884  
    3737#include "pmMoments.h"
    3838#include "pmModelFuncs.h"
     39#include "pmModelClass.h"
    3940#include "pmModel.h"
    4041#include "pmModelUtils.h"
    41 #include "pmModelClass.h"
    4242#include "pmSourceMasks.h"
    4343#include "pmSourceExtendedPars.h"
     
    9797            yErr = dPAR[PM_PAR_YPOS];
    9898            if (isfinite(PAR[PM_PAR_SXX]) && isfinite(PAR[PM_PAR_SXX]) && isfinite(PAR[PM_PAR_SXX])) {
    99                 axes = pmPSF_ModelToAxes (PAR, model->type);
     99                axes = pmPSF_ModelToAxes (PAR, model->class->useReff);
    100100            } else {
    101101                axes.major = NAN;
     
    259259        dPAR[PM_PAR_I0]   = (isfinite(source->psfMag)) ? PAR[PM_PAR_I0] * source->psfMagErr : NAN;
    260260
    261         pmPSF_AxesToModel (PAR, axes, modelType);
     261        pmPSF_AxesToModel (PAR, axes, model->class->useReff);
    262262
    263263        float peakMag     = psMetadataLookupF32 (&status, row, "PEAK_FLUX_AS_MAG");
     
    524524            yErr = dPAR[PM_PAR_YPOS];
    525525
    526             axes = pmPSF_ModelToAxes (PAR, model->type);
     526            axes = pmPSF_ModelToAxes (PAR, model->class->useReff);
    527527
    528528            row = psMetadataAlloc ();
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmSourceIO_RAW.c

    r36623 r36884  
    3737#include "pmMoments.h"
    3838#include "pmModelFuncs.h"
     39#include "pmModelClass.h"
    3940#include "pmModel.h"
    4041#include "pmModelUtils.h"
    41 #include "pmModelClass.h"
    4242#include "pmSourceMasks.h"
    4343#include "pmSourceExtendedPars.h"
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmSourceIO_SMPDATA.c

    r36623 r36884  
    3737#include "pmMoments.h"
    3838#include "pmModelFuncs.h"
     39#include "pmModelClass.h"
    3940#include "pmModel.h"
    4041#include "pmModelUtils.h"
    41 #include "pmModelClass.h"
    4242#include "pmSourceMasks.h"
    4343#include "pmSourceExtendedPars.h"
     
    9393            lsky = (source->sky < 1.0) ? 0.0 : log10(source->sky);
    9494
    95             axes = pmPSF_ModelToAxes (PAR, model->type);
     95            axes = pmPSF_ModelToAxes (PAR, model->class->useReff);
    9696
    9797        } else {
     
    190190        axes.theta       = psMetadataLookupF32 (&status, row, "THETA");
    191191
    192         pmPSF_AxesToModel (PAR, axes, modelType);
     192        pmPSF_AxesToModel (PAR, axes, model->class->useReff);
    193193
    194194        source->psfMag = psMetadataLookupF32 (&status, row, "MAG_RAW") - ZERO_POINT;
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmSourceIO_SX.c

    r36623 r36884  
    3737#include "pmMoments.h"
    3838#include "pmModelFuncs.h"
     39#include "pmModelClass.h"
    3940#include "pmModel.h"
    4041#include "pmModelUtils.h"
    41 #include "pmModelClass.h"
    4242#include "pmSourceMasks.h"
    4343#include "pmSourceExtendedPars.h"
     
    8282        // pmSourceSextractType (source, &type, &flags);
    8383
    84         axes = pmPSF_ModelToAxes (PAR, model->type);
     84        axes = pmPSF_ModelToAxes (PAR, model->class->useReff);
    8585
    8686        psLineInit (line);
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmSourceMatch.c

    r36623 r36884  
    1818#include "pmMoments.h"
    1919#include "pmModelFuncs.h"
     20#include "pmModelClass.h"
    2021#include "pmModel.h"
    2122#include "pmModelUtils.h"
    22 #include "pmModelClass.h"
    2323#include "pmSourceMasks.h"
    2424#include "pmSourceExtendedPars.h"
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmSourceMoments.c

    r36623 r36884  
    3535#include "pmMoments.h"
    3636#include "pmModelFuncs.h"
     37#include "pmModelClass.h"
    3738#include "pmModel.h"
    3839#include "pmModelUtils.h"
    39 #include "pmModelClass.h"
    4040#include "pmSourceMasks.h"
    4141#include "pmSourceExtendedPars.h"
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmSourceOutputs.c

    r36623 r36884  
    2626#include "pmMoments.h"
    2727#include "pmModelFuncs.h"
     28#include "pmModelClass.h"
    2829#include "pmModel.h"
    2930#include "pmModelUtils.h"
    30 #include "pmModelClass.h"
    3131#include "pmSourceMasks.h"
    3232#include "pmSourceExtendedPars.h"
     
    108108        }
    109109        if (isfinite(PAR[PM_PAR_SXX]) && isfinite(PAR[PM_PAR_SXY]) && isfinite(PAR[PM_PAR_SYY])) {
    110             axes = pmPSF_ModelToAxes (PAR, model->type);
     110            axes = pmPSF_ModelToAxes (PAR, model->class->useReff);
    111111            outputs->psfMajor = axes.major;
    112112            outputs->psfMinor = axes.minor;
    113113            outputs->psfTheta = axes.theta*PS_DEG_RAD;
     114
     115            // some models (PS1_V1, QGAUSS) have an extra 'core' parameter
     116            outputs->psfCore = NAN;
     117            if (model->type == pmModelClassGetType ("PS_MODEL_PS1_V1")) {
     118                outputs->psfCore = PAR[PM_PAR_7];
     119            }
     120            if (model->type == pmModelClassGetType ("PS_MODEL_QGAUSS")) {
     121                outputs->psfCore = PAR[PM_PAR_7];
     122            }
     123
     124            outputs->psfMajorFWHM = model->class->modelSetFWHM(model->params, axes.major);
     125            outputs->psfMinorFWHM = model->class->modelSetFWHM(model->params, axes.minor);
    114126        } else {
    115127            outputs->psfMajor = NAN;
    116128            outputs->psfMinor = NAN;
    117129            outputs->psfTheta = NAN;
     130            outputs->psfCore = NAN;
    118131        }
    119132        outputs->chisq = model->chisq;
    120133        outputs->nDOF = model->nDOF;
    121134        outputs->nPix = model->nPix;
    122         outputs->apRadius = source->apRadius;
    123135    } else {
    124136        bool useMoments = pmSourcePositionUseMoments(source);
     
    138150        outputs->psfMinor = NAN;
    139151        outputs->psfTheta = NAN;
     152        outputs->psfCore = NAN;
    140153        outputs->chisq = NAN;
    141154        outputs->nDOF = 0;
    142155        outputs->nPix = 0;
    143         outputs->apRadius = NAN;
    144156    }
    145157
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmSourceOutputs.h

    r33690 r36884  
    2626    float psfMinor;
    2727    float psfTheta;
     28    float psfCore;
     29    float psfMajorFWHM;
     30    float psfMinorFWHM;
    2831    float chisq;
    29     float apRadius;
    3032    int nPix;
    3133    int nDOF;
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmSourcePhotometry.c

    r36623 r36884  
    3333#include "pmMoments.h"
    3434#include "pmModelFuncs.h"
     35#include "pmModelClass.h"
    3536#include "pmModel.h"
    3637#include "pmModelUtils.h"
    37 #include "pmModelClass.h"
    3838#include "pmSourceMasks.h"
    3939#include "pmSourceExtendedPars.h"
     
    330330
    331331    // measure fitMag
    332     flux = model->modelFlux (model->params);
     332    flux = model->class->modelFlux (model->params);
    333333    if (flux > 0) {
    334334        mag = -2.5*log10(flux);
     
    359359
    360360    bool status;
    361     int nPix = 0;
    362     status = pmSourcePhotometryAper(&nPix, &source->apMagRaw, &source->apFlux, &source->apFluxErr, model, image, variance, mask, maskVal);
     361    status = pmSourcePhotometryAper(&source->apNpixels, &source->apMagRaw, &source->apFlux, &source->apFluxErr, model, image, variance, mask, maskVal);
    363362    if (status) {
    364363        source->mode |= PM_SOURCE_MODE_AP_MAGS;
     
    490489
    491490            // for the full model, add all points
    492             value = fabs(model->modelFunc (NULL, params, coord) - sky);
     491            value = fabs(model->class->modelFunc (NULL, params, coord) - sky);
    493492            modelSum += value;
    494493
     
    893892
    894893            // for the full model, add all points
    895             float value = model->modelFunc (NULL, params, coord);
     894            float value = model->class->modelFunc (NULL, params, coord);
    896895
    897896            // fprintf (stderr, "%d, %d : %f, %f : %f - %f : %f\n",
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmSourcePlotApResid.c

    r36623 r36884  
    3535#include "pmMoments.h"
    3636#include "pmModelFuncs.h"
     37#include "pmModelClass.h"
    3738#include "pmModel.h"
    3839#include "pmModelUtils.h"
    39 #include "pmModelClass.h"
    4040#include "pmSourceMasks.h"
    4141#include "pmSourceExtendedPars.h"
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmSourcePlotMoments.c

    r36623 r36884  
    3838#include "pmMoments.h"
    3939#include "pmModelFuncs.h"
     40#include "pmModelClass.h"
    4041#include "pmModel.h"
    4142#include "pmModelUtils.h"
    42 #include "pmModelClass.h"
    4343#include "pmSourceMasks.h"
    4444#include "pmSourceExtendedPars.h"
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmSourcePlotPSFModel.c

    r36623 r36884  
    3939#include "pmMoments.h"
    4040#include "pmModelFuncs.h"
     41#include "pmModelClass.h"
    4142#include "pmModel.h"
    4243#include "pmModelUtils.h"
    43 #include "pmModelClass.h"
    4444#include "pmSourceMasks.h"
    4545#include "pmSourceExtendedPars.h"
     
    147147        // force the axis ratio to be < 20.0
    148148        psEllipseAxes axes_mnt = psEllipseMomentsToAxes (moments, 20.0);
    149         psEllipseAxes axes_psf = pmPSF_ModelToAxes (PAR, model->type);
     149        psEllipseAxes axes_psf = pmPSF_ModelToAxes (PAR, model->class->useReff);
    150150
    151151        // moments major axis
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmSourceSky.c

    r36623 r36884  
    3434#include "pmMoments.h"
    3535#include "pmModelFuncs.h"
     36#include "pmModelClass.h"
    3637#include "pmModel.h"
    3738#include "pmModelUtils.h"
    38 #include "pmModelClass.h"
    3939#include "pmSourceMasks.h"
    4040#include "pmSourceExtendedPars.h"
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmSourceUtils.c

    r36623 r36884  
    3434#include "pmMoments.h"
    3535#include "pmModelFuncs.h"
     36#include "pmModelClass.h"
    3637#include "pmModel.h"
    3738#include "pmModelUtils.h"
    38 #include "pmModelClass.h"
    3939#include "pmSourceMasks.h"
    4040#include "pmSourceExtendedPars.h"
     
    6565    pmModel *model = pmModelAlloc(modelType);
    6666
    67     if (!model->modelGuess(model, source, maskVal, markVal)) {
     67    if (!model->class->modelGuess(model, source, maskVal, markVal)) {
    6868        psFree (model);
    6969        return NULL;
  • branches/eam_branches/ipp-20140610/psModules/src/objects/pmSourceVisual.c

    r36834 r36884  
    1616#include "pmMoments.h"
    1717#include "pmModelFuncs.h"
     18#include "pmModelClass.h"
    1819#include "pmModel.h"
    1920#include "pmModelUtils.h"
    20 #include "pmModelClass.h"
    2121#include "pmSourceMasks.h"
    2222#include "pmSourceExtendedPars.h"
  • branches/eam_branches/ipp-20140610/psModules/src/psmodules.h

    r36834 r36884  
    129129
    130130#include <pmModelFuncs.h>
     131#include <pmModelClass.h>
    131132#include <pmModel.h>
    132133#include <pmModel_CentralPixel.h>
     
    149150#include <pmSourcePlots.h>
    150151#include <pmPSF_IO.h>
    151 #include <pmModelClass.h>
    152152#include <pmModelUtils.h>
    153153#include <pmSourcePhotometry.h>
  • branches/eam_branches/ipp-20140610/psastro/doc/outline.txt

    r26259 r36884  
    33
    44  psastroParseCamera
     5    psastroDefineFiles
    56  psastroDataLoad
    6     psastroConvertReadout (save PSASTRO.RAWSTARS & PSASTRO.RAWSTARS.SUBSET on readout->analysis)
     7    psastroConvertReadout (saves PSASTRO.RAWSTARS on readout->analysis)
     8      psastroCorrectKH
    79  psastroAnalysis
    810    psastroUseModel
    911    psastroAstromGuess (plots PSASTRO.RAWSTARS)
     12    psastroRemoveClumpsRawstars (saves PSASTRO.RAWSTARS.SUBSET on readout->analysis)
    1013    psastroLoadRefstars (loads full reference star set)
    1114    psastroChooseRefstars (save PSASTRO.REFSTARS & PSASTRO.REFSTARS.SUBSET on readout->analysis)
  • branches/eam_branches/ipp-20140610/psastro/src/psastroConvert.c

    r36837 r36884  
    199199        // effect (all affected data was processed BEFORE the bug was introduced), and it
    200200        // does not affect any of the PV2 or PV3 data processed AFTER the bug was fixed.
    201         psEllipseAxes axes = pmPSF_ModelToAxes (PAR, model->type);
     201        psEllipseAxes axes = pmPSF_ModelToAxes (PAR, model->class->useReff);
    202202
    203203        pmAstromObj *obj = pmAstromObjAlloc ();
  • branches/eam_branches/ipp-20140610/psphot/src/psphotChoosePSF.c

    r36623 r36884  
    448448
    449449            // get the model full-width at half-max
    450             float FWHM_MAJOR = 2*modelPSF->modelRadius (modelPSF->params, 0.5);
     450            float FWHM_MAJOR = 2*modelPSF->class->modelRadius (modelPSF->params, 0.5);
    451451
    452452            // XXX make sure this is consistent with the re-definition of PM_PAR_SXX
  • branches/eam_branches/ipp-20140610/psphot/src/psphotEfficiency.c

    r34353 r36884  
    7171                continue;
    7272            }
    73             float flux = normModel->modelFlux(normModel->params); // Total flux for peak of 1.0
     73            float flux = normModel->class->modelFlux(normModel->params); // Total flux for peak of 1.0
    7474            psFree(normModel);
    7575            if (!isfinite(flux)) {
     
    424424                    continue;
    425425                }
    426                 float sourceRadius = PS_MAX(radius, model->modelRadius(model->params, minFlux)); // Radius for source
     426                float sourceRadius = PS_MAX(radius, model->class->modelRadius(model->params, minFlux)); // Radius for source
    427427                psFree(model);
    428428                if (!isfinite(sourceRadius)) {
  • branches/eam_branches/ipp-20140610/psphot/src/psphotEvalFLT.c

    r17396 r36884  
    5353    }
    5454
    55     keep = model->modelFitStatus(model);
     55    keep = model->class->modelFitStatus(model);
    5656    if (keep) return true;
    5757
  • branches/eam_branches/ipp-20140610/psphot/src/psphotFullForceSummaryReadout.c

    r36759 r36884  
    425425                // copy the best fit params to the model
    426426                // fractional radii with the lowest chisq
    427                 psEllipseAxes axes = pmPSF_ModelToAxes(model->params->data.F32, model->type);
     427                psEllipseAxes axes = pmPSF_ModelToAxes(model->params->data.F32, model->class->useReff);
    428428
    429429                // examine the params for the trial with minimum chisq.
     
    637637                // now save the model parameters in the model structure
    638638
    639                 pmPSF_AxesToModel (model->params->data.F32, axes, modelType);
     639                pmPSF_AxesToModel (model->params->data.F32, axes, model->class->useReff);
    640640
    641641                model->mag = -2.5 * log10(flux0);
  • branches/eam_branches/ipp-20140610/psphot/src/psphotGalaxyShape.c

    r36757 r36884  
    283283
    284284        // I have some source guess (e0, e1, e2)
    285         psEllipseAxes guessAxes = pmPSF_ModelToAxes (PAR, modelType);
     285        psEllipseAxes guessAxes = pmPSF_ModelToAxes (PAR, model->class->useReff);
    286286
    287287        float fRmajorBest = NAN;
     
    295295                testAxes.minor = guessAxes.minor * fRminor;
    296296               
    297                 pmPSF_AxesToModel (PAR, testAxes, modelType);
     297                pmPSF_AxesToModel (PAR, testAxes, model->class->useReff);
    298298               
    299299                psphotGalaxyShapeSource (pcm, source, galaxyFits, maskVal, psfSize, true);
     
    324324#endif
    325325           
    326             pmPSF_AxesToModel (PAR, testAxes, modelType);
     326            pmPSF_AxesToModel (PAR, testAxes, model->class->useReff);
    327327               
    328328            psphotGalaxyShapeSource (pcm, source, galaxyFits, maskVal, psfSize, false);
     
    400400
    401401    pcm->modelConv->params->data.F32[PM_PAR_I0] = Io;
    402     float flux = pcm->modelConv->modelFlux (pcm->modelConv->params);
     402    float flux = pcm->modelConv->class->modelFlux (pcm->modelConv->params);
    403403    float dflux = flux * (dIo / Io);
    404404
  • branches/eam_branches/ipp-20140610/psphot/src/psphotLensing.c

    r36662 r36884  
    1212    psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE);
    1313    psAssert (recipe, "missing recipe?");
     14
     15    // perform full extended source non-linear fits?
     16    if (!psMetadataLookupBool (&status, recipe, "LENSING_PARAMETERS")) {
     17        psLogMsg ("psphot", PS_LOG_INFO, "skipping extended source fits\n");
     18        return true;
     19    }
    1420
    1521    int num = psphotFileruleCount(config, filerule);
     
    8793    }
    8894
     95    psMetadataAddBool(readout->analysis, PS_LIST_TAIL, "LENS_OBJ", PS_META_REPLACE, "per-object lensing stats measured", true);
    8996    psLogMsg ("psphot.lensing", PS_LOG_DETAIL, "calculate lensing parameters for %d objects\n", (int) sources->n);
    9097
     
    317324    psFree (stats);
    318325
     326    psMetadataAddBool(readout->analysis, PS_LIST_TAIL, "LENS_PSF", PS_META_REPLACE, "psf-trend lensing stats measured", true);
    319327    psLogMsg ("psphot.lensing", PS_LOG_DETAIL, "calculate lensing parameters for %d objects: %f sec\n", (int) sources->n, psTimerMark ("psphot.lensing"));
    320328
  • branches/eam_branches/ipp-20140610/psphot/src/psphotLoadSRCTEXT.c

    r32348 r36884  
    7373            dPAR[PM_PAR_I0]   = 0.0;
    7474
    75             pmPSF_AxesToModel (PAR, axes, modelType);
     75            pmPSF_AxesToModel (PAR, axes, model->class->useReff);
    7676
    7777            float peakFlux    = 1.0;
  • branches/eam_branches/ipp-20140610/psphot/src/psphotMakeFluxScale.c

    r30624 r36884  
    3838            } else {
    3939                // measure the fitMag for this model
    40                 fitSum = model->modelFlux (model->params);
     40                fitSum = model->class->modelFlux (model->params);
    4141            }
    4242            if (fitSum < 1.e-6) continue;
  • branches/eam_branches/ipp-20140610/psphot/src/psphotRadiusChecks.c

    r36086 r36884  
    6060    if (radiusFit <= 0) {               // use fixed radius
    6161        if (moments == NULL) {
    62             radiusFit = model->modelRadius(model->params, PSF_FIT_NSIGMA*moments->dSky);
     62            radiusFit = model->class->modelRadius(model->params, PSF_FIT_NSIGMA*moments->dSky);
    6363        } else {
    64             radiusFit = model->modelRadius(model->params, 1.0);
     64            radiusFit = model->class->modelRadius(model->params, 1.0);
    6565        }
    6666        model->fitRadius = (RADIUS_TYPE)(radiusFit + PSF_FIT_PADDING);
     
    9595    if (radiusFit <= 0) {               // use fixed radius
    9696        if (moments == NULL) {
    97             radiusFit = model->modelRadius(model->params, PSF_FIT_NSIGMA*moments->dSky);
     97            radiusFit = model->class->modelRadius(model->params, PSF_FIT_NSIGMA*moments->dSky);
    9898        } else {
    99             radiusFit = model->modelRadius(model->params, 1.0);
     99            radiusFit = model->class->modelRadius(model->params, 1.0);
    100100        }
    101101        model->fitRadius = (RADIUS_TYPE)(radiusFit + PSF_FIT_PADDING);
     
    294294    float flux = deep ? EXT_FIT_NSIGMA*EXT_FIT_SKY_SIG : 0.1 * model->params->data.F32[PM_PAR_I0];
    295295
    296     float rawRadius = model->modelRadius (model->params, flux);
     296    float rawRadius = model->class->modelRadius (model->params, flux);
    297297    if (isnan(rawRadius)) return false;
    298298
  • branches/eam_branches/ipp-20140610/psphot/src/psphotSersicModelClass.c

    r33410 r36884  
    586586            coord->data.F32[1] = (psF32) (i + source->pixels->row0);
    587587
    588             pcm->modelConvFlux->data.F32[i][j] = pcm->modelConv->modelFunc (NULL, params, coord);
     588            pcm->modelConvFlux->data.F32[i][j] = pcm->modelConv->class->modelFunc (NULL, params, coord);
    589589        }
    590590    }
  • branches/eam_branches/ipp-20140610/psphot/src/psphotSourceFits.c

    r36375 r36884  
    700700        model->params->data.F32[PM_PAR_7] = 0.5/indexGuess[i];
    701701
    702         if (!model->modelGuess(model, source, maskVal, markVal)) {
     702        if (!model->class->modelGuess(model, source, maskVal, markVal)) {
    703703            model->flags |= PM_MODEL_STATUS_BADARGS;
    704704            return false;
     
    723723    model->flags = PM_MODEL_STATUS_NONE; // do not attempt to handle failures here, let the next iteration deal with it
    724724    model->params->data.F32[PM_PAR_7] = 0.5/indexGuess[iMin];
    725     model->modelGuess(model, source, maskVal, markVal);
     725    model->class->modelGuess(model, source, maskVal, markVal);
    726726
    727727    return true;
     
    752752        model->params->data.F32[PM_PAR_7] = indexGuess[i];
    753753       
    754         if (!model->modelGuess(model, source, maskVal, markVal)) {
     754        if (!model->class->modelGuess(model, source, maskVal, markVal)) {
    755755            model->flags |= PM_MODEL_STATUS_BADARGS;
    756756            return false;
  • branches/eam_branches/ipp-20140610/psphot/src/psphotVisual.c

    r35769 r36884  
    14441444            coord->data.F32[1] = r;
    14451445            coord->data.F32[0] = 0.0;
    1446             fmaj->data.F32[i] = log10(source->modelPSF->modelFunc (NULL, params, coord));
     1446            fmaj->data.F32[i] = log10(source->modelPSF->class->modelFunc (NULL, params, coord));
    14471447
    14481448            coord->data.F32[0] = r;
    14491449            coord->data.F32[1] = 0.0;
    1450             fmin->data.F32[i] = log10(source->modelPSF->modelFunc (NULL, params, coord));
     1450            fmin->data.F32[i] = log10(source->modelPSF->class->modelFunc (NULL, params, coord));
    14511451        }
    14521452        psFree (coord);
    14531453        psFree (params);
    14541454
    1455         float FWHM_MAJOR = 2.0*source->modelPSF->modelRadius (source->modelPSF->params, 0.5*source->modelPSF->params->data.F32[PM_PAR_I0]);
     1455        float FWHM_MAJOR = 2.0*source->modelPSF->class->modelRadius (source->modelPSF->params, 0.5*source->modelPSF->params->data.F32[PM_PAR_I0]);
    14561456        float FWHM_MINOR = FWHM_MAJOR * (axes.minor / axes.major);
    14571457        if (FWHM_MAJOR < FWHM_MINOR) PS_SWAP (FWHM_MAJOR, FWHM_MINOR);
  • branches/eam_branches/ipp-20140610/psphot/test/tap_psphot_galaxies.pro

    r35769 r36884  
    3232$FakeOptions = $BaseOptions
    3333$FakeOptions = $FakeOptions -exptime 30.0
     34# $FakeOptions = $FakeOptions -D PSF.MODEL PS_MODEL_PS1_V1
    3435$FakeOptions = $FakeOptions -D PSF.MODEL PS_MODEL_GAUSS
    3536 
     
    4445
    4546# basic config for ppSim with randomly distributed stars and gridded galaxies
    46 $FakeConfig = -camera SIMTEST
    47 $FakeConfig = $FakeConfig -recipe PPSIM STACKTEST.RUN
    48 $FakeConfig = $FakeConfig -D PSASTRO:PSASTRO.CATDIR catdir.ref
    49 $FakeConfig = $FakeConfig -Db STARS.FAKE F                         ; # only use stars from catdir.ref
    50 $FakeConfig = $FakeConfig -Db MATCH.DENSITY F
    51 $FakeConfig = $FakeConfig -Db PSF.CONVOLVE T
    52 $FakeConfig = $FakeConfig -Db GALAXY.FAKE T                        ; # generate a "realistic" distribution of galaxies
    53 $FakeConfig = $FakeConfig -Df GALAXY.MAG 17.0
    54 $FakeConfig = $FakeConfig -Db GALAXY.GRID T                        ; # generate a grid of galaxies (constant mag)
    55 #$FakeConfig = $FakeConfig -D GALAXY.MODEL PS_MODEL_GAUSS
    56 #$FakeConfig = $FakeConfig -D GALAXY.MODEL PS_MODEL_EXP
    57 #$FakeConfig = $FakeConfig -D GALAXY.MODEL PS_MODEL_SERSIC
    58 #$FakeConfig = $FakeConfig -D GALAXY.MODEL PS_MODEL_DEV
    59 $FakeConfig = $FakeConfig -Df GALAXY.RMAJOR.MIN 10.0
    60 $FakeConfig = $FakeConfig -Df GALAXY.RMAJOR.MAX 10.0
    61 $FakeConfig = $FakeConfig -Df GALAXY.ARATIO.MIN 0.25
    62 $FakeConfig = $FakeConfig -Df GALAXY.ARATIO.MAX 0.25
    63 $FakeConfig = $FakeConfig -Df GALAXY.THETA.MIN 0
    64 $FakeConfig = $FakeConfig -Df GALAXY.THETA.MAX 180
    65 $FakeConfig = $FakeConfig -Df GALAXY.INDEX.MIN 1.66
    66 $FakeConfig = $FakeConfig -Df GALAXY.INDEX.MAX 1.66
    67 $FakeConfig = $FakeConfig -Di GALAXY.GRID.DX 120
    68 $FakeConfig = $FakeConfig -Di GALAXY.GRID.DY 120
     47if (1)
     48  $FakeConfig = -camera SIMTEST
     49  $FakeConfig = $FakeConfig -recipe PPSIM STACKTEST.RUN
     50  $FakeConfig = $FakeConfig -D PSASTRO:PSASTRO.CATDIR catdir.ref
     51  $FakeConfig = $FakeConfig -Db STARS.FAKE F                         ; # only use stars from catdir.ref
     52  $FakeConfig = $FakeConfig -Db MATCH.DENSITY F
     53  $FakeConfig = $FakeConfig -Db PSF.CONVOLVE T
     54  $FakeConfig = $FakeConfig -Db GALAXY.FAKE T                        ; # generate a "realistic" distribution of galaxies
     55  $FakeConfig = $FakeConfig -Df GALAXY.MAG 17.0
     56  $FakeConfig = $FakeConfig -Db GALAXY.GRID F                        ; # generate a grid of galaxies (constant mag)
     57  #$FakeConfig = $FakeConfig -D GALAXY.MODEL PS_MODEL_GAUSS
     58  #$FakeConfig = $FakeConfig -D GALAXY.MODEL PS_MODEL_EXP
     59  #$FakeConfig = $FakeConfig -D GALAXY.MODEL PS_MODEL_SERSIC
     60  #$FakeConfig = $FakeConfig -D GALAXY.MODEL PS_MODEL_DEV
     61  $FakeConfig = $FakeConfig -Df GALAXY.RMAJOR.MIN 10.0
     62  $FakeConfig = $FakeConfig -Df GALAXY.RMAJOR.MAX  1.0
     63  $FakeConfig = $FakeConfig -Df GALAXY.ARATIO.MIN 0.25
     64  $FakeConfig = $FakeConfig -Df GALAXY.ARATIO.MAX 1.00
     65  $FakeConfig = $FakeConfig -Df GALAXY.THETA.MIN 0
     66  $FakeConfig = $FakeConfig -Df GALAXY.THETA.MAX 180
     67  $FakeConfig = $FakeConfig -Df GALAXY.INDEX.MIN 1.66
     68  $FakeConfig = $FakeConfig -Df GALAXY.INDEX.MAX 1.66
     69  $FakeConfig = $FakeConfig -Di GALAXY.GRID.DX 120
     70  $FakeConfig = $FakeConfig -Di GALAXY.GRID.DY 120
     71end
     72
     73# basic config for ppSim with randomly distributed stars and gridded galaxies
     74if (0)
     75  $FakeConfig = -camera SIMTEST
     76  $FakeConfig = $FakeConfig -recipe PPSIM STACKTEST.RUN
     77  $FakeConfig = $FakeConfig -D PSASTRO:PSASTRO.CATDIR catdir.ref
     78  $FakeConfig = $FakeConfig -Db STARS.FAKE F                         ; # only use stars from catdir.ref
     79  $FakeConfig = $FakeConfig -Db MATCH.DENSITY F
     80  $FakeConfig = $FakeConfig -Db PSF.CONVOLVE T
     81  $FakeConfig = $FakeConfig -Db GALAXY.FAKE T                        ; # generate a "realistic" distribution of galaxies
     82  $FakeConfig = $FakeConfig -Df GALAXY.MAG 17.0
     83  $FakeConfig = $FakeConfig -Db GALAXY.GRID T                        ; # generate a grid of galaxies (constant mag)
     84  #$FakeConfig = $FakeConfig -D GALAXY.MODEL PS_MODEL_GAUSS
     85  #$FakeConfig = $FakeConfig -D GALAXY.MODEL PS_MODEL_EXP
     86  #$FakeConfig = $FakeConfig -D GALAXY.MODEL PS_MODEL_SERSIC
     87  #$FakeConfig = $FakeConfig -D GALAXY.MODEL PS_MODEL_DEV
     88  $FakeConfig = $FakeConfig -Df GALAXY.RMAJOR.MIN 10.0
     89  $FakeConfig = $FakeConfig -Df GALAXY.RMAJOR.MAX 10.0
     90  $FakeConfig = $FakeConfig -Df GALAXY.ARATIO.MIN 0.25
     91  $FakeConfig = $FakeConfig -Df GALAXY.ARATIO.MAX 0.25
     92  $FakeConfig = $FakeConfig -Df GALAXY.THETA.MIN 0
     93  $FakeConfig = $FakeConfig -Df GALAXY.THETA.MAX 180
     94  $FakeConfig = $FakeConfig -Df GALAXY.INDEX.MIN 1.66
     95  $FakeConfig = $FakeConfig -Df GALAXY.INDEX.MAX 1.66
     96  $FakeConfig = $FakeConfig -Di GALAXY.GRID.DX 120
     97  $FakeConfig = $FakeConfig -Di GALAXY.GRID.DY 120
     98end
    6999
    70100list fwhm
     
    164194  $psphotConfig = $psphotConfig -Di PSPHOT:LMM_FIT_GAIN_FACTOR_MODE 2
    165195  $psphotConfig = $psphotConfig -Db PSPHOT:SAVE.RESID T
     196  # $psphotConfig = $psphotConfig -D  PSPHOT:PSF_MODEL PS_MODEL_PS1_V1
     197  $psphotConfig = $psphotConfig -D  PSPHOT:PSF_MODEL PS_MODEL_GAUSS
    166198  $psphotConfig = $psphotConfig -D  PSPHOT:EXTENDED_SOURCE_MODELS_SELECTION $fitModel
     199  $psphotConfig = $psphotConfig -D  PSPHOT:OUTPUT.FORMAT PS1_V5
    167200
    168201  # ppImage / psphot on the output
     
    217250
    218251  # plot (input - output) vs mag
     252end
     253
     254macro ck.poserrors
     255  reindex X_raw_m = X_raw using index2
     256  reindex X_out_m = X_PSF_out using index1
     257  reindex dX_out_m = X_PSF_SIG_out using index1
     258  set Xoff = X_raw_m - X_out_m
     259  reindex M_raw_m = PSF_INST_MAG_raw using index2
     260
     261  # lim M_raw_m Xoff; clear; box; plot M_raw_m Xoff
     262  set dC = Xoff^2 / dX_out_m^2
     263  lim M_raw_m dX_out_m; clear; box; plot M_raw_m dX_out_m
    219264end
    220265
  • branches/eam_branches/ipp-20140610/pstamp/scripts/pstamp_checkdependent.pl

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20140610/pstamp/scripts/pstamp_finish.pl

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20140610/pstamp/scripts/pstamp_webrequest.pl

    r35439 r36884  
    9393    my $command = "$psmkreq --req_name $request_name  --output $request_file @ARGV";
    9494
     95if (0) {
     96open DEBUG, ">>/tmp/pstamp.debug.log";
     97print DEBUG "\ncommand is: $command\n";
     98close DEBUG;
     99}
     100
    95101    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    96102        run(command => $command, verbose => $verbose);
    97103    unless ($success) {
    98104        print STDERR @$stderr_buf;
     105        print STDERR "\ncommand was: $command\n";
    99106        die("Unable to perform psmkreq: $error_code");
    100107    }
  • branches/eam_branches/ipp-20140610/pstamp/scripts/pstampparse.pl

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20140610/pswarp/src/pswarpTransformSources.c

    r34800 r36884  
    120120#if 0
    121121        // XXX Note that this will not set the correct axes
    122         psEllipseAxes axes = pmPSF_ModelToAxes(source->modelPSF->params->data.F32, 20.0, source->modelPSF->type);
    123         pmPSF_AxesToModel(new->modelPSF->params->data.F32, axes, new->modelPSF->type);
     122        psEllipseAxes axes = pmPSF_ModelToAxes(source->modelPSF->params->data.F32, 20.0, source->modelPSF->class->useReff);
     123        pmPSF_AxesToModel(new->modelPSF->params->data.F32, axes, new->modelPSF->class->useReff);
    124124#endif
    125125
Note: See TracChangeset for help on using the changeset viewer.