# Astrometry near the galactic plane

**URL:** <https://www.rubin.community/t/astrometry-near-the-galactic-plane/3753>\
**Category:** Support\
**Tags:** hsc, hscpipe\
**Created:** [July 5, 2019, 2:38am UTC](https://www.rubin.community/t/astrometry-near-the-galactic-plane/3753 "2019-07-05T02:38:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![surhudm](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/surhudm/32/872_2.png) [@surhudm](https://www.rubin.community/u/surhudm)\
**Post date:** [July 5, 2019, 2:38am UTC](https://www.rubin.community/t/astrometry-near-the-galactic-plane/3753/1 "2019-07-05T02:38:37Z")

</div>

I am trying to reduce a field taken with Subaru HSC which is near the galactic plane with hscPipe 6.7. When running `processCcd`, the astrometric solution found by the `calibrate` task is off, which then creates further problems for the `photoCal` task. My guess is this is happening due to the large number of stars in the field which make chance matches possible.

Surprisingly, instead of the standard configuration paramaters, if I pass `config.processCcd.isr.doSaturation=False`, the astrometry solution found is correct. In my debugging investigations, I found that the stars in the `usableSourceCat` passed to the `_doMatch` task are fairly similar in both set of configurations.

Question: is the `_doMatch` task in `lsst/meas/astrom/matchOptimisticB/matchOptimisticBContinued.py` applying some additional flags before performing the matching to the PanStarrs catalog? Is there a way to disable these flags given the large number of saturated stars in the galactic plane? I have tried the following to no avail.

```auto
config.processCcd.charImage.ref_match.sourceSelection.flags.bad=[]
config.processCcd.charImage.ref_match.matcher.sourceSelector['science'].flags.bad=[]
config.processCcd.calibrate.astrometry.matcher.sourceSelector['science'].flags.bad=[]
config.processCcd.calibrate.astrometry.sourceSelection.flags.bad=[]
config.processCcd.calibrate.photoCal.match.sourceSelection.flags.bad=[]
config.processCcd.charImage.ref_match.matcher.sourceSelector['astrometry'].badFlags=[]
config.processCcd.charImage.ref_match.matcher.sourceSelector['matcher'].badFlags=[]
config.processCcd.calibrate.astrometry.matcher.sourceSelector['astrometry'].badFlags=[]
config.processCcd.calibrate.astrometry.matcher.sourceSelector['matcherPessimistic'].badFlags=[]

```

---

<div class="post-metadata">

**Author:** ![surhudm](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/surhudm/32/872_2.png) [@surhudm](https://www.rubin.community/u/surhudm)\
**Post date:** [July 5, 2019, 5:13am UTC](https://www.rubin.community/t/astrometry-near-the-galactic-plane/3753/2 "2019-07-05T05:13:45Z")

</div>

A quick edit: Browsing through JIRA, I found that I need to use the `matchPessimisticB` task instead of `matchOptimistic` task for the dense stellar field.

I was able to retarget the task by adding the following in a config file and now it seems to work fine on the test ccd I was reducing:

```auto
from lsst.meas.astrom.matchPessimisticB import MatchPessimisticBTask
config.processCcd.calibrate.astrometry.matcher.retarget(MatchPessimisticBTask)

```
