# forcedPhotCcd.py fails to perform measurement due to WCS issue

**URL:** <https://www.rubin.community/t/forcedphotccd-py-fails-to-perform-measurement-due-to-wcs-issue/3233>\
**Category:** Support\
**Created:** [September 11, 2018, 5:25pm UTC](https://www.rubin.community/t/forcedphotccd-py-fails-to-perform-measurement-due-to-wcs-issue/3233 "2018-09-11T17:25:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmyles](https://avatars.discourse-cdn.com/v4/letter/j/e36b37/32.png) [@jmyles](https://www.rubin.community/u/jmyles)\
**Post date:** [September 11, 2018, 5:25pm UTC](https://www.rubin.community/t/forcedphotccd-py-fails-to-perform-measurement-due-to-wcs-issue/3233/1 "2018-09-11T17:25:09Z")

</div>

I’m following the tutorial at [pipelines.lsst.io](https://pipelines.lsst.io/getting-started/photometry.html) and am trying to implement forced photometry on individual exposures with forcedPhotCcd.py. All the stages of the tutorial up to and including doing the photometry on the coadds with forcedPhotCoadd.py have run successfully. When I run the following commands

```
forcedPhotCcd.py $DATADIR --rerun coaddPhot:ccdForcedPhot --id filter=HSC-R &> r_band_output.txt
forcedPhotCcd.py $DATADIR --rerun ccdForcedPhot --id filter=HSC-I &> i_band_output.txt

```

the output includes the following error:

```
FatalAlgorithmError: CModel forced measurement currently requires the measurement image to have the same Wcs as the reference catalog (this is a temporary limitation)

```

I am running on a spawned machine on `lsst-lspdev` with version 16 of the stack. I’m unsure why the measurement image apparently doesn’t have the same WCS as the reference catalog because I made a skymap for the exposures following the tutorial.

The end result is that forcedPhotCcd.py writes an empty table to `forced_src_schema.fits` and no other FITS files. Does anyone know what might help here?

---

<div class="post-metadata">

**Author:** ![jbosch](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/jbosch/32/12_2.png) [@jbosch](https://www.rubin.community/u/jbosch)\
**Post date:** [September 11, 2018, 5:38pm UTC](https://www.rubin.community/t/forcedphotccd-py-fails-to-perform-measurement-due-to-wcs-issue/3233/2 "2018-09-11T17:38:57Z")

</div>

You’ll need to disable the CModel galaxy photometry for now; I think this in a config file passed with `-C` should do it:

```
config.measurement.plugins.names -= ["modelfit_CModel"]
```

---

<div class="post-metadata">

**Author:** ![jmyles](https://avatars.discourse-cdn.com/v4/letter/j/e36b37/32.png) [@jmyles](https://www.rubin.community/u/jmyles)\
**Post date:** [September 11, 2018, 6:31pm UTC](https://www.rubin.community/t/forcedphotccd-py-fails-to-perform-measurement-due-to-wcs-issue/3233/3 "2018-09-11T18:31:42Z")

</div>

Thanks for taking a look. Including that in a config file that I pass in now leads to the following ValueError:

````auto
  File "/opt/lsst/software/stack/stack/miniconda3-4.3.21-10a4fa6/Linux64/meas_base/16.0+1/bin/forcedPhotCcd.py", line 24, in <module>
    ForcedPhotCcdTask.parseAndRun()
  File "/opt/lsst/software/stack/stack/miniconda3-4.3.21-10a4fa6/Linux64/pipe_base/16.0+1/python/lsst/pipe/base/cmdLineTask.py", line 570, in parseAndRun
    parsedCmd = argumentParser.parse_args(config=config, args=args, log=log, override=cls.applyOverrides)
  File "/opt/lsst/software/stack/stack/miniconda3-4.3.21-10a4fa6/Linux64/pipe_base/16.0+1/python/lsst/pipe/base/argumentParser.py", line 649, in parse_args
    namespace.config.validate()
  File "/opt/lsst/software/stack/stack/miniconda3-4.3.21-10a4fa6/Linux64/pex_config/16.0/python/lsst/pex/config/config.py", line 690, in validate
    field.validate(self)
  File "/opt/lsst/software/stack/stack/miniconda3-4.3.21-10a4fa6/Linux64/pex_config/16.0/python/lsst/pex/config/configurableField.py", line 259, in validate
    value.validate()
  File "/opt/lsst/software/stack/stack/miniconda3-4.3.21-10a4fa6/Linux64/meas_base/16.0+1/python/lsst/meas/base/baseMeasurement.py", line 172, in validate
    raise ValueError("source flux slot algorithm '%s' is not being run." % slot)
ValueError: source flux slot algorithm 'modelfit_CModel' is not being run.```
````

---

<div class="post-metadata">

**Author:** ![price](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/price/32/488_2.png) [@price](https://www.rubin.community/u/price)\
**Post date:** [September 11, 2018, 6:52pm UTC](https://www.rubin.community/t/forcedphotccd-py-fails-to-perform-measurement-due-to-wcs-issue/3233/4 "2018-09-11T18:52:41Z")

</div>

I think we need to strike [the following line from `obs_subaru/config/forcedPhotCcd.py`](https://github.com/lsst/obs_subaru/blob/master/config/forcedPhotCcd.py#L7):

```
config.load(os.path.join(getPackageDir("obs_subaru"), "config", "cmodel.py"))
```

---

<div class="post-metadata">

**Author:** ![jmyles](https://avatars.discourse-cdn.com/v4/letter/j/e36b37/32.png) [@jmyles](https://www.rubin.community/u/jmyles)\
**Post date:** [September 12, 2018, 5:44pm UTC](https://www.rubin.community/t/forcedphotccd-py-fails-to-perform-measurement-due-to-wcs-issue/3233/5 "2018-09-12T17:44:06Z")

</div>

Thanks for your help with this. Problem resolved by passing in a config file [[link](https://github.com/lsst/ci_hsc/blob/master/forcedPhotCcdConfig.py)] to override the default obs\_subaru/config/forcedPhotCcd.py [[link](https://github.com/lsst/obs_subaru/blob/master/config/forcedPhotCcd.py#L7)]. Running the command `forcedPhotCcd.py $DATADIR --rerun coaddPhot:ccdForcedPhot --id filter=HSC-R --clobber-config --configfile=/project/shared/data/ci_hsc/forcedPhotCcdConfig.py` worked.
