Commits
Pam Ford authored b375b1f6a29 Merge
1593 1593 | } |
1594 1594 | } |
1595 1595 | |
1596 1596 | if (fieldId_p<0 || !seenSource) { // i.e. not found, or not at this spwid |
1597 1597 | String src = String(&names_.su_name[sourceno*16],16); |
1598 1598 | |
1599 1599 | nsources_p++; |
1600 1600 | sources_p = src; |
1601 1601 | |
1602 1602 | Double epoch=mjd0_p+Double(proper_.pm_epoch); |
1603 - | IPosition shape(2, 2, 2); |
1603 + | Int numPol = 0; |
1604 + | if (abs(proper_.pm_ra)+abs(proper_.pm_dec) > 0) { |
1605 + | numPol = 1; |
1606 + | } |
1607 + | IPosition shape(2, 2, numPol+1); |
1604 1608 | Matrix<Double> dir(shape); |
1605 1609 | // convert proper motions from s & " per year to rad/s |
1606 1610 | const Double arcsecPerYear=C::arcsec/(365.25*C::day); |
1607 1611 | dir(0, 0)=doubles_.su_ra[sourceno]; |
1608 1612 | dir(1, 0)=doubles_.su_dec[sourceno]; |
1609 - | dir(0, 1)=proper_.pm_ra*15.*arcsecPerYear; // (15"/s) |
1610 - | dir(1, 1)=proper_.pm_dec*arcsecPerYear; |
1611 - | |
1613 + | if (numPol>0) { |
1614 + | dir(0, 1)=proper_.pm_ra*15.*arcsecPerYear; // (15"/s) |
1615 + | dir(1, 1)=proper_.pm_dec*arcsecPerYear; |
1616 + | } |
1617 + | |
1612 1618 | if (fieldId_p<0) { |
1613 1619 | os_p << LogIO::DEBUGGING << "Found field:" << src << LogIO::POST; |
1620 + | if (numPol>0) os_p << LogIO::DEBUGGING << "Field:" << src << " has proper motion parameters"<<LogIO::POST; |
1614 1621 | fieldId_p=nField_p++; |
1615 1622 | atms_p.field().addRow(); |
1616 1623 | Int nf=atms_p.field().nrow()-1; |
1617 1624 | // for now we have 1 field/source |
1618 1625 | msc_p->field().sourceId().put(nf,fieldId_p); |
1619 1626 | msc_p->field().name().put(nf,src.before(trailing)); |
1620 1627 | |
1621 1628 | msc_p->field().phaseDir().put(nf,dir); |
1622 1629 | msc_p->field().delayDir().put(nf,dir); |
1623 1630 | msc_p->field().referenceDir().put(nf, dir); |
1624 - | msc_p->field().numPoly().put(nf, 1); |
1631 + | msc_p->field().numPoly().put(nf, numPol); |
1625 1632 | msc_p->field().time().put(nf,epoch); |
1626 1633 | msc_p->field().code().put(nf,String(&names_.su_cal[sourceno*16], |
1627 1634 | 16).before(trailing)); |
1628 1635 | } |
1629 1636 | dir(0, 0)=doubles_.su_pra[sourceno]; |
1630 1637 | dir(1, 0)=doubles_.su_pdec[sourceno]; |
1631 1638 | Vector<Double> srcdir(2); |
1632 1639 | srcdir(0)=doubles_.su_ra[sourceno]; |
1633 1640 | srcdir(1)=doubles_.su_dec[sourceno]; |
1634 1641 | atms_p.source().addRow(); |
1675 1682 | // dummy fill |
1676 1683 | msc_p->source().calibrationGroup().put(ns,-1); |
1677 1684 | } |
1678 1685 | |
1679 1686 | Bool fillPointingTable=False; //Imaging fails with pointing table filled |
1680 1687 | if (fillPointingTable && |
1681 1688 | (fieldId_p != prev_fieldId_p || newPointingCorr_p)) { |
1682 1689 | prev_fieldId_p = fieldId_p; |
1683 1690 | Double epoch=mjd0_p+Double(proper_.pm_epoch); |
1684 1691 | Int np=atms_p.pointing().nrow(); |
1685 - | IPosition shape(2, 2, 2); |
1692 + | IPosition shape(2, 2, 1); |
1686 1693 | Matrix<Double> pointingDir(shape,0.0); |
1687 1694 | pointingDir(0, 0)=doubles_.su_pra[sourceno]; |
1688 1695 | pointingDir(1, 0)=doubles_.su_pdec[sourceno]; |
1689 1696 | Matrix<Double> pointingOffset(shape,0.0); |
1690 1697 | for (Int i=0; i<nAnt_p; i++) { |
1691 1698 | atms_p.pointing().addRow(); |
1692 1699 | msc_p->pointing().antennaId().put(np+i, i+1); |
1693 1700 | if (newPointingCorr_p) { |
1694 1701 | pointingOffset(0, 0)=pointingCorr_p(0,i)*C::arcsec; |
1695 1702 | pointingOffset(1, 0)=pointingCorr_p(0,i)*C::arcsec; |
1696 1703 | } |
1697 1704 | if (i==0) { // ISM storage |
1698 1705 | msc_p->pointing().time().put(np,epoch); |
1699 1706 | msc_p->pointing().interval().put(np,DBL_MAX); |
1700 - | msc_p->pointing().numPoly().put(np, 1); |
1707 + | msc_p->pointing().numPoly().put(np, 0); |
1701 1708 | msc_p->pointing().direction().put(np,pointingDir); |
1702 1709 | msc_p->pointing().pointingOffset().put(np,pointingOffset); |
1703 1710 | msc_p->pointing().tracking().put(np,True); |
1704 1711 | } else { |
1705 1712 | if (newPointingCorr_p) { |
1706 1713 | msc_p->pointing().pointingOffset().put(np,pointingOffset); |
1707 1714 | } |
1708 1715 | } |
1709 1716 | } |
1710 1717 | } |