public software.sextractor

[/] [branches/] [multi/] [src/] [photom.c] - Diff between revs 283 and 285

Show entire file | Details | Blame | View Log

Rev 283 Rev 285
Line 20... Line 20...
*       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*       GNU General Public License for more details.
*       GNU General Public License for more details.
*       You should have received a copy of the GNU General Public License
*       You should have received a copy of the GNU General Public License
*       along with SExtractor. If not, see <http://www.gnu.org/licenses/>.
*       along with SExtractor. If not, see <http://www.gnu.org/licenses/>.
*
*
*       Last modified:          03/04/2012
*       Last modified:          06/05/2012
*
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 
#ifdef HAVE_CONFIG_H
#ifdef HAVE_CONFIG_H
#include        "config.h"
#include        "config.h"
Line 533... Line 533...
        number of images,
        number of images,
        pointer to the obj2 structure.
        pointer to the obj2 structure.
OUTPUT  -.
OUTPUT  -.
NOTES   -.
NOTES   -.
AUTHOR  E. Bertin (IAP)
AUTHOR  E. Bertin (IAP)
VERSION 03/04/2012
VERSION 06/05/2012
 ***/
 ***/
void  photom_auto(fieldstruct **fields, fieldstruct **wfields,
void  photom_auto(fieldstruct **fields, fieldstruct **wfields,
                        int nfield, obj2struct *obj2)
                        int nfield, obj2struct *obj2)
 
 
  {
  {
Line 706... Line 706...
      f = field->imindex;
      f = field->imindex;
      pflag = (field->detector_type==DETECTOR_PHOTO);
      pflag = (field->detector_type==DETECTOR_PHOTO);
 
 
      w = subimage->imsize[0];
      w = subimage->imsize[0];
      h = subimage->imsize[1];
      h = subimage->imsize[1];
      mx = subimage->dpos[0];
      mx = subimage->dpos[0] - (double)subimage->immin[0];
      my = subimage->dpos[1];
      my = subimage->dpos[1] - (double)subimage->immin[1];
 
 
      jac = subimage->dinvjacob;
      jac = subimage->dinvjacob;
      cx2 = jac[0]*jac[0]*obj2->cxx
      cx2 = jac[0]*jac[0]*obj2->cxx
        + jac[2]*jac[2]*obj2->cyy
        + jac[2]*jac[2]*obj2->cyy
        + jac[0]*jac[2]*obj2->cxy;
        + jac[0]*jac[2]*obj2->cxy;
Line 750... Line 750...
 
 
      area = areab = 0;
      area = areab = 0;
      tv = sigtv = 0.0;
      tv = sigtv = 0.0;
      image = subimage->image;
      image = subimage->image;
      weight = subimage->weight;
      weight = subimage->weight;
 
 
      for (y=ymin; y<ymax; y++)
      for (y=ymin; y<ymax; y++)
        {
        {
        imaget = image + (pos = xmin + (y%h)*w);
        imaget = image + (pos = xmin + (y%h)*w);
        if (wfield)
        if (wfield)
          weightt = weight + pos;
          weightt = weight + pos;
Line 940... Line 939...
INPUT   Pointer to the image structure,
INPUT   Pointer to the image structure,
        pointer to the obj2 structure.
        pointer to the obj2 structure.
OUTPUT  -.
OUTPUT  -.
NOTES   -.
NOTES   -.
AUTHOR  E. Bertin (IAP)
AUTHOR  E. Bertin (IAP)
VERSION 16/03/2012
VERSION 06/05/2012
 ***/
 ***/
void    photom_mags(fieldstruct *field, obj2struct *obj2)
void    photom_mags(fieldstruct *field, obj2struct *obj2)
  {
  {
/* Mag. isophotal */
/* Mag. isophotal */
  if (FLAG(obj2.mag_iso))
  if (FLAG(obj2.mag_iso))
Line 1001... Line 1000...
    obj2->magerr_somfit = obj2->flux_somfit>0.0?
    obj2->magerr_somfit = obj2->flux_somfit>0.0?
                         1.086*obj2->fluxerr_somfit/obj2->flux_somfit
                         1.086*obj2->fluxerr_somfit/obj2->flux_somfit
                        :99.0;
                        :99.0;
 
 
/* Mag. models */
/* Mag. models */
  if (FLAG(obj2.mag_prof))
 
    obj2->mag_prof = obj2->flux_prof>0.0?
 
                         -2.5*log10(obj2->flux_prof) + prefs.mag_zeropoint[0]
 
                        :99.0;
 
  if (FLAG(obj2.magerr_prof))
 
    obj2->magerr_prof = obj2->flux_prof>0.0?
 
                         1.086*obj2->fluxerr_prof/obj2->flux_prof
 
                        :99.0;
 
 
 
  if (FLAG(obj2.magcor_prof))
  if (FLAG(obj2.magcor_prof))
    obj2->magcor_prof = obj2->fluxcor_prof>0.0?
    obj2->magcor_prof = obj2->fluxcor_prof>0.0?
                         -2.5*log10(obj2->fluxcor_prof) + prefs.mag_zeropoint[0]
                         -2.5*log10(obj2->fluxcor_prof) + prefs.mag_zeropoint[0]
                        :99.0;
                        :99.0;
  if (FLAG(obj2.magcorerr_prof))
  if (FLAG(obj2.magcorerr_prof))
Line 1043... Line 1033...
                 / (prefs.pixel_scale? field->pixscale*field->pixscale
                 / (prefs.pixel_scale? field->pixscale*field->pixscale
                                : obj2->pixscale2 * 3600.0*3600.0))
                                : obj2->pixscale2 * 3600.0*3600.0))
                + prefs.mag_zeropoint[0]
                + prefs.mag_zeropoint[0]
                : 99.0;
                : 99.0;
 
 
  if (FLAG(obj2.prof_dirac_mag))
 
    obj2->prof_dirac_mag = obj2->prof_dirac_flux>0.0?
 
                         -2.5*log10(obj2->prof_dirac_flux)
 
                        + prefs.mag_zeropoint[0]
 
                        :99.0;
 
 
 
  if (FLAG(obj2.prof_dirac_magerr))
 
    obj2->prof_dirac_magerr = obj2->prof_dirac_flux>0.0?
 
                         1.086*obj2->prof_dirac_fluxerr
 
                                / obj2->prof_dirac_flux
 
                        :99.0;
 
 
 
  if (FLAG(obj2.prof_spheroid_mag))
 
    obj2->prof_spheroid_mag = obj2->prof_spheroid_flux>0.0?
 
                         -2.5*log10(obj2->prof_spheroid_flux)
 
                        + prefs.mag_zeropoint[0]
 
                        :99.0;
 
 
 
  if (FLAG(obj2.prof_spheroid_mumax))
  if (FLAG(obj2.prof_spheroid_mumax))
    obj2->prof_spheroid_mumax = obj2->prof_spheroid_peak > 0.0 ?
    obj2->prof_spheroid_mumax = obj2->prof_spheroid_peak > 0.0 ?
                -2.5*log10((obj2->prof_spheroid_peak)
                -2.5*log10((obj2->prof_spheroid_peak)
                 / (prefs.pixel_scale? field->pixscale*field->pixscale
                 / (prefs.pixel_scale? field->pixscale*field->pixscale
                                : obj2->pixscale2 * 3600.0*3600.0))
                                : obj2->pixscale2 * 3600.0*3600.0))
Line 1085... Line 1057...
                 / (prefs.pixel_scale? field->pixscale*field->pixscale
                 / (prefs.pixel_scale? field->pixscale*field->pixscale
                                : obj2->pixscale2 * 3600.0*3600.0))
                                : obj2->pixscale2 * 3600.0*3600.0))
                + prefs.mag_zeropoint[0]
                + prefs.mag_zeropoint[0]
                : 99.0;
                : 99.0;
 
 
  if (FLAG(obj2.prof_spheroid_magerr))
 
    obj2->prof_spheroid_magerr = obj2->prof_spheroid_flux>0.0?
 
                         1.086*obj2->prof_spheroid_fluxerr
 
                                / obj2->prof_spheroid_flux
 
                        :99.0;
 
 
 
  if (FLAG(obj2.prof_disk_mag))
 
    obj2->prof_disk_mag = obj2->prof_disk_flux>0.0?
 
                         -2.5*log10(obj2->prof_disk_flux)
 
                        + prefs.mag_zeropoint[0]
 
                        :99.0;
 
  if (FLAG(obj2.prof_disk_magerr))
 
    obj2->prof_disk_magerr = obj2->prof_disk_flux>0.0?
 
                         1.086*obj2->prof_disk_fluxerr
 
                                / obj2->prof_disk_flux
 
                        :99.0;
 
 
 
  if (FLAG(obj2.prof_disk_mumax))
  if (FLAG(obj2.prof_disk_mumax))
    obj2->prof_disk_mumax = obj2->prof_disk_peak > 0.0 ?
    obj2->prof_disk_mumax = obj2->prof_disk_peak > 0.0 ?
                -2.5*log10((obj2->prof_disk_peak)
                -2.5*log10((obj2->prof_disk_peak)
                 / (prefs.pixel_scale? field->pixscale*field->pixscale
                 / (prefs.pixel_scale? field->pixscale*field->pixscale
                                : obj2->pixscale2 * 3600.0*3600.0))
                                : obj2->pixscale2 * 3600.0*3600.0))