IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 28675


Ignore:
Timestamp:
Jul 15, 2010, 6:29:09 AM (16 years ago)
Author:
eugene
Message:

fix sersic parameterization; allow grid to have random values; change pmSourceCopy to pmSourceCopyData

Location:
branches/eam_branches/ipp-20100621/ppSim/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20100621/ppSim/src/ppSimMakeGalaxies.c

    r28659 r28675  
    1818    int galaxyGridDX      = psMetadataLookupS32(&mdok, recipe, "GALAXY.GRID.DX"); // Density of fakes
    1919    int galaxyGridDY      = psMetadataLookupS32(&mdok, recipe, "GALAXY.GRID.DY"); // Density of fakes
     20    bool galaxyGridRandom = psMetadataLookupBool(&mdok, recipe, "GALAXY.GRID.RANDOM"); // Density of fakes
    2021   
    2122    float galaxyRmajorMax = psMetadataLookupF32(&mdok, recipe, "GALAXY.RMAJOR.MAX"); // Density of fakes
     
    4344
    4445    if (galaxyDensity <= 0) return true;
     46
     47    if (galaxyGridRandom) {
     48        long A, B;
     49        A = time(NULL);
     50        for (B = 0; A == time(NULL); B++);
     51        srand48(B);
     52    }
    4553
    4654    // Size of FPA
     
    8189        psLogMsg("ppSim", PS_LOG_INFO, "Adding grid of %ld galaxies\n", num);
    8290
    83         float galaxyIndexSlope = (galaxyIndexMax - galaxyIndexMin) / num;
    84         float galaxyThetaSlope = (galaxyThetaMax - galaxyThetaMin) / num;
    85         float galaxyARatioSlope = (galaxyARatioMax - galaxyARatioMin) / num;
    86         float galaxyRmajorSlope = (galaxyRmajorMax - galaxyRmajorMin) / num;
     91        float galaxyIndexSlope = (galaxyIndexMax - galaxyIndexMin);
     92        float galaxyThetaSlope = (galaxyThetaMax - galaxyThetaMin);
     93        float galaxyARatioSlope = (galaxyARatioMax - galaxyARatioMin);
     94        float galaxyRmajorSlope = (galaxyRmajorMax - galaxyRmajorMin);
    8795
    8896        int i = 0;
     
    101109                // galaxy->index = (1/2n)
    102110
    103                 float index = (galaxyIndexMin  + i * galaxyIndexSlope); // factor of 0.5 because the Sersic model creates exp(-z^n), not exp(-r^n)
     111                float factor = galaxyGridRandom ? drand48() : i / num;
     112                float index = (galaxyIndexMin  + factor * galaxyIndexSlope); // factor of 0.5 because the Sersic model creates exp(-z^n), not exp(-r^n)
    104113                galaxy->index = 0.5/index;
    105114
    106                 float scale = (galaxyRmajorMin + i * galaxyRmajorSlope);
     115                factor = galaxyGridRandom ? drand48() : i / num;
     116                float scale = (galaxyRmajorMin + factor * galaxyRmajorSlope);
    107117
    108118                // for a sersic model,
     
    114124
    115125                galaxy->Rmaj  = scale;
    116                 galaxy->Rmin  = (galaxyARatioMin + i * galaxyARatioSlope) * galaxy->Rmaj;
    117                 galaxy->theta = (galaxyThetaMin  + i * galaxyThetaSlope);
     126
     127                factor = galaxyGridRandom ? drand48() : i / num;
     128                galaxy->Rmin  = (galaxyARatioMin + factor * galaxyARatioSlope) * galaxy->Rmaj;
     129
     130                factor = galaxyGridRandom ? drand48() : i / num;
     131                galaxy->theta = (galaxyThetaMin  + factor * galaxyThetaSlope);
    118132
    119133                // galaxy->peak *= Io;
    120134
    121                 fprintf (stderr, "Rmaj: %f, scale: %f, index: %f, bn: %f, Ro: %f, Io: %f\n",
    122                          galaxy->Rmaj, scale, index, bn, fR, Io);
     135                if (0) {
     136                    fprintf (stderr, "Rmaj: %f, scale: %f, index: %f, bn: %f, Ro: %f, Io: %f\n", galaxy->Rmaj, scale, index, bn, fR, Io);
     137                }
    123138
    124139                psArrayAdd (galaxies, 100, galaxy);
  • branches/eam_branches/ipp-20100621/ppSim/src/ppSimPhotomReadout.c

    r27657 r28675  
    6969    psArray *fakeSources = psArrayAlloc (injectedSources->n);
    7070    for (int i = 0; i < injectedSources->n; i++) {
    71       fakeSources->data[i] = pmSourceCopy (injectedSources->data[i]);
     71      fakeSources->data[i] = pmSourceCopyData (injectedSources->data[i]);
    7272    }
    7373
  • branches/eam_branches/ipp-20100621/ppSim/src/ppSimPhotomReadoutFake.c

    r27657 r28675  
    4040    psArray *fakeSources = psArrayAlloc (injectedSources->n);
    4141    for (int i = 0; i < injectedSources->n; i++) {
    42       fakeSources->data[i] = pmSourceCopy (injectedSources->data[i]);
     42      fakeSources->data[i] = pmSourceCopyData (injectedSources->data[i]);
    4343    }
    4444
     
    4747    psArray *realSources = psArrayAlloc (realMeasuredSources->n);
    4848    for (int i = 0; i < realMeasuredSources->n; i++) {
    49         realSources->data[i] = pmSourceCopy (realMeasuredSources->data[i]);
     49        realSources->data[i] = pmSourceCopyData (realMeasuredSources->data[i]);
    5050    }
    5151
  • branches/eam_branches/ipp-20100621/ppSim/src/ppSimPhotomReadoutForce.c

    r27657 r28675  
    4646    psArray *realSources = psArrayAlloc (realMeasuredSources->n);
    4747    for (int i = 0; i < realMeasuredSources->n; i++) {
    48         realSources->data[i] = pmSourceCopy (realMeasuredSources->data[i]);
     48        realSources->data[i] = pmSourceCopyData (realMeasuredSources->data[i]);
    4949    }
    5050
Note: See TracChangeset for help on using the changeset viewer.