docs: def remeasure(mpc_in, reset_pixel_coordinates=True):
      """
      Compute the RA/DEC of the line based on the X/Y in the comment and the WCS of the associated image.
  
      Comment of supplied astrometric line (mpc_in) must be in OSSOSComment format.
  
      @param mpc_in: An line of astrometric measurement to recompute the RA/DEC from the X/Y in the comment.
      @type mpc_in: mp_ephem.Observation
      @param reset_pixel_coordinates: try and determine correct X/Y is X/Y doesn't map to correct RA/DEC value
      @type reset_pixel_coordinates: bool
      @type reset_pixecl_coordinates: bool
  
      """
      if mpc_in.null_observation:
          return mpc_in
      mpc_obs = deepcopy(mpc_in)
      logging.debug("rm start: {}".format(mpc_obs.to_string()))
  
      if not isinstance(mpc_obs.comment, mp_ephem.ephem.OSSOSComment):
          logging.error("Failed to convert comment line")
          return mpc_in
  
      parts = re.search('(?P<expnum>\d{7})(?P<type>\S)(?P<ccd>\d\d)', str(mpc_obs.comment.frame))
      if not parts:
          logging.error("Failed to parse expnum from frame info in comment line")
          return mpc_in
      ccd = int(parts.group('ccd'))
      expnum = int(parts.group('expnum'))
      exp_type = parts.group('type')
  
      try:
          header = _connection_error_wrapper(storage._get_sghead, expnum)[ccd+1]
      except IOError as ioerr:
          logging.error(str(ioerr))
          logging.error("Failed to get astrometric header for: {}".format(mpc_obs))
          return mpc_in
  
      this_wcs = wcs.WCS(header)
  
      coordinate = this_wcs.xy2sky(mpc_obs.comment.x, mpc_obs.comment.y, usepv=True)
      mpc_obs.coordinate = coordinate[0].to('degree').value, coordinate[1].to('degree').value
      sep = mpc_in.coordinate.separation(mpc_obs.coordinate)
  
      if sep > TOLERANCE*20 and mpc_in.discovery and _flipped_ccd(ccd):
          logging.warn("Large ({}) offset using X/Y in comment line to compute RA/DEC".format(sep))
          if reset_pixel_coordinates:
              logging.info("flipping/flopping the discvoery x/y position recorded.")
              x = header['NAXIS1'] - mpc_obs.comment.x + 1
              y = header['NAXIS2'] - mpc_obs.comment.y + 1
              new_coordinate = this_wcs.xy2sky(x, y, usepv=True)
              new_sep = mpc_in.coordinate.separation(new_coordinate)
              if new_sep < TOLERANCE*2:
                  mpc_obs.coordinate = new_coordinate
                  mpc_obs.comment.x = x
                  mpc_obs.comment.y = y
                  sep = new_sep
  
      if sep > TOLERANCE:
          # use the old header RA/DEC to predict the X/Y and then use that X/Y to get new RA/DEC
          logging.warn("sep: {} --> large offset when using comment line X/Y to compute RA/DEC")
          if reset_pixel_coordinates:
             logging.warn("Using RA/DEC and original WCS to compute X/Y and replacing X/Y in comment.".format(sep))
             header2 = _connection_error_wrapper(storage.get_astheader, expnum, ccd)
             image_wcs = wcs.WCS(header2)
             (x, y) = image_wcs.sky2xy(mpc_in.coordinate.ra.degree, mpc_in.coordinate.dec.degree, usepv=False)
             mpc_obs.coordinate = this_wcs.xy2sky(x, y, usepv=True)
             mpc_obs.comment.x = x
             mpc_obs.comment.y = y
             logging.info("Coordinate changed: ({:5.2f},{:5.2f}) --> ({:5.2f},{:5.2f})".format(mpc_obs.comment.x,
                                                                                               mpc_obs.comment.y,
                                                                                               x, y))
  
      if mpc_obs.comment.mag_uncertainty is not None:
          try:
              merr = float(mpc_obs.comment.mag_uncertainty)
              fwhm = float(_connection_error_wrapper(storage.get_fwhm, expnum, ccd))
              centroid_err = merr * fwhm * header['PIXSCAL1']
              logging.debug("Centroid uncertainty:  {} {} => {}".format(merr, fwhm, centroid_err))
          except Exception as err:
              logging.error(str(err))
              logging.error("Failed to compute centroid_err for observation:\n"
                            "{}\nUsing default of 0.2".format(mpc_obs.to_string()))
              centroid_err = 0.2
      else:
          centroid_err = 0.2
  
      mpc_obs.comment.astrometric_level = header.get('ASTLEVEL', "0")
  
      try:
          asterr = float(header['ASTERR'])
          residuals = (asterr ** 2 + centroid_err ** 2) ** 0.5
          logging.debug("Residuals: {} {} => {}".format(asterr, centroid_err, residuals))
      except Exception as err:
          logging.error(str(err))
          logging.error("Failed while trying to compute plate uncertainty for\n{}".format(mpc_obs.to_string()))
          logging.error('Using default of 0.25')
          residuals = 0.25
  
      mpc_obs.comment.plate_uncertainty = residuals
  
      logging.debug("sending back: {}".format(mpc_obs.to_string()))
  
      return mpc_obs