[INSTRM-1403] Add table to relate matched guidestar with spot Created: 16/Oct/21  Updated: 05/Nov/21  Resolved: 05/Nov/21

Status: Done
Project: Instrument control development
Component/s: spt_operational_database
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Normal
Reporter: hassan Assignee: Kiyoto Yabe
Resolution: Done Votes: 0
Labels: EngRun
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Story Points: 2
Sprint: PreEngRun4, EngRun3Cleanup
Reviewers: hassan

 Description   

Following from the ICS/PFI telecon 2021-10-15: provide a mapping between the observed objects using the AGC and the stars in the input catalogue.

This might be just a join key from the guide_stars table to the agc_data table, but this should be investigated.



 Comments   
Comment by Kiyoto Yabe [ 26/Oct/21 ]

I pushed the current implementation draft in https://github.com/Subaru-PFS/spt_operational_database/blob/tickets/INSTRM-1403/python/opdb/models.py 

We use the similar table as `cobra_match` for matching of spots on AGC like this. 

class guide_star_match(Base):
    '''AGC matching information.
    '''

    __tablename__ = 'guide_star_match'
    __table_args__ = (UniqueConstraint('pfs_design_id', 'guide_star_id'),
                      ForeignKeyConstraint(['agc_exposure_id', 'agc_camera_id', 'spot_id'],
                                           ['agc_data.agc_exposure_id', 'agc_data.agc_camera_id', 'agc_data.spot_id']),
                      {})

    pfs_design_id = Column(BigInteger,
                           primary_key=True, unique=False, autoincrement=False,
                           comment='pfsDesignId'
                           )
    guide_star_id = Column(BigInteger,
                           primary_key=True, unique=False, autoincrement=False,
                           comment='GuideStar identifier'
                           )
    agc_exposure_id = Column(Integer,
                             comment='AGC exposure number identifier')
    agc_camera_id = Column(Integer,
                           comment='AGC camera identifier')
    spot_id = Column(Integer,
                     comment='The AGC spot identifier')
    column_placeholder = Column(REAL)
    flags = Column(Integer, comment='Flags')

Any comments are welcome.

Comment by Kiyoto Yabe [ 27/Oct/21 ]

I'm not sure who should be the reviewer but feel free to re-assign.

Comment by hassan [ 28/Oct/21 ]

The proposed table and key constraints look great. No additional comments.

Comment by Kiyoto Yabe [ 28/Oct/21 ]

Sorry hassan, after talking to Yoshida, Hiroshige personally, we decided to revert to the original idea:

class agc_match(Base):
    '''AGC matching information.
    '''

    __tablename__ = 'agc_match'
    __table_args__ = (UniqueConstraint('agc_exposure_id', 'agc_camera_id', 'spot_id'),
                      ForeignKeyConstraint(['agc_exposure_id', 'agc_camera_id', 'spot_id'],
                                           ['agc_data.agc_exposure_id', 'agc_data.agc_camera_id', 'agc_data.spot_id']),
                      {})

    agc_exposure_id = Column(Integer,
                             primary_key=True, unique=False, autoincrement=False,
                             comment='AGC exposure number identifier')
    agc_camera_id = Column(Integer,
                           primary_key=True, unique=False, autoincrement=False,
                           comment='AGC camera identifier')
    spot_id = Column(Integer,
                     primary_key=True, unique=False, autoincrement=False,
                     comment='The AGC spot identifier')
    pfs_design_id = Column(BigInteger,
                           comment='pfsDesignId')
    guide_star_id = Column(BigInteger,
                           comment='GuideStar identifier')
    agc_nominal_x_mm = Column(REAL,
                              comment='Nominal designed x-position on the AGC [PFI mm]')
    agc_nominal_y_mm = Column(REAL,
                              comment='Nominal designed y-position on the AGC [PFI mm]')
    agc_center_x_mm = Column(REAL,
                             comment='Center measured x-position on the AGC [PFI mm]')
    agc_center_y_mm = Column(REAL,
                             comment='Center measured y-position on the AGC [PFI mm]')
    flags = Column(Integer, comment='Flags')

 
I also added columns for the designed and measured position of spots in PFI coordinate. The naming is similar to that in cobra tables (which is originated from datamodel in the long history), but it may not be so easy to understand. 

So, could both of you (hassan  and Yoshida, Hiroshige) review them again please?

Comment by hassan [ 28/Oct/21 ]

Thanks for the updates. But shouldn't the additional columns be in agc_data?

As they are additional columns, and the main purpose of this ticket is to ensure we can map guidestar with spot, I'm fine if you and Yoshida-san feel that these additional columns are necessary.

Comment by Kiyoto Yabe [ 29/Oct/21 ]

I think `agc_data` should contain purely detections and measured values in pix, so I excluded positions in mm from the table as in `mcs_data` and `cobra_match`. I'm not sure whether we need those information but it would be useful.

Comment by hassan [ 03/Nov/21 ]

Proposed schema seems acceptable for the Nov Eng Run. Further revisions after that may be possible but will be captured in future tickets.

Comment by Kiyoto Yabe [ 04/Nov/21 ]

OK, I'll merge the current one.

Generated at Sat Feb 10 16:35:06 JST 2024 using Jira 8.3.4#803005-sha1:1f96e09b3c60279a408a2ae47be3c745f571388b.