# How to link deepCoadd objects to forced\_src ones?

**URL:** <https://www.rubin.community/t/how-to-link-deepcoadd-objects-to-forced-src-ones/1200>\
**Category:** Data Management\
**Created:** [September 30, 2016, 1:52pm UTC](https://www.rubin.community/t/how-to-link-deepcoadd-objects-to-forced-src-ones/1200 "2016-09-30T13:52:00Z")\
**Posts on this page:** 1\
**Showing post:** 4

<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 30, 2016, 2:57pm UTC](https://www.rubin.community/t/how-to-link-deepcoadd-objects-to-forced-src-ones/1200/4 "2016-09-30T14:57:06Z")

</div>

Ah, sorry, I didn’t grok the question.

The `visit` and `ccd` are stored in the `deepCoadd`. Try something like this:

```
coaddId = dict(tract=12345, patch='6,7', filter="i")
exp = butler.get("deepCoadd", coaddId, immediate=True)
ccdInputs = exp.getInfo().getCoaddInfo().ccds
visitKey = ccdInputs.schema.find("visit").key
ccdKey = ccdInputs.schema.find("ccd").key
for ccdRecord in ccdInputs:
    dataId = dict(visit=ccdRecord.get(visitKey), ccd=ccdRecord.get(ccdKey))
    # Work around problem with adding 'tract' to key
    dataRefList = list(butler.subset("raw", dataId))
    assert(len(dataRefList) == 0)
    dataRef = dataRefList.pop()
    forced = dataRef.get("forced_src", tract=coaddId['tract'], immediate=True)

```

I took the bones of this from [`lsst.pipe.tasks.propagateVisitFlags`](https://github.com/lsst/pipe_tasks/blob/master/python/lsst/pipe/tasks/propagateVisitFlags.py).

The problem with adding `tract` to the `dataId` is mentioned [here](http://www.rubin.community/t/problem-with-megacam-dataid/1199/6).

---

_[View the full topic](https://www.rubin.community/t/how-to-link-deepcoadd-objects-to-forced-src-ones/1200)._
