def _get_coord(self, mask, mesa, X, Y) -> list: """ Get various coordinates. Return [xs_mesa, ys_mesa, xs_pad, ys_pad, X_pad, Y_pad]. :return: [xs_mesa, ys_mesa, xs_pad, ys_pad, X_pad, Y_pad] """ query = ('SELECT dX, dY, xm_mesa, ym_mesa, xm_pad, ym_pad ' 'FROM v02_mesa WHERE mask=%s AND mesa=%s') resp = self.q_row_abs(query, (mask, mesa,)) dX, dY, xm_mesa, ym_mesa, xm_pad, ym_pad = resp return calc_coord(X, Y, dX, dY, xm_mesa, ym_mesa, xm_pad, ym_pad)
def _get_coord(self, mask, mesa, X, Y) -> list: """ Get various coordinates. Return [xs_mesa, ys_mesa, xs_pad, ys_pad, X_pad, Y_pad]. :return: [xs_mesa, ys_mesa, xs_pad, ys_pad, X_pad, Y_pad] """ query = ('SELECT dX, dY, xm_mesa, ym_mesa, xm_pad, ym_pad ' 'FROM v02_mesa WHERE mask=%s AND mesa=%s') resp = self.q_row_abs(query, ( mask, mesa, )) dX, dY, xm_mesa, ym_mesa, xm_pad, ym_pad = resp return calc_coord(X, Y, dX, dY, xm_mesa, ym_mesa, xm_pad, ym_pad)
def update_coords(db_rds, sample, commit=False): oper = ('SELECT X, Y, dX, dY, xm_mesa, ym_mesa, xm_pad, ym_pad, ' 'device_id ' 'FROM v04_device WHERE sample=%s') db_rds.exe(oper, (sample, )) dev_params = db_rds.fetchall() data = [] for p in dev_params: X_pad, Y_pad, X_mesa, Y_mesa = calc_coord(*p[:8]) device_id = p[8] data.append([X_pad, Y_pad, X_mesa, Y_mesa, sample, device_id]) oper = ('UPDATE device ' 'SET X_pad=%s, Y_pad=%s, X_mesa=%s, Y_mesa=%s ' 'WHERE sample=%s AND device_id=%s') print('update_coords: updating...') db_rds.exem(oper, data) if commit: db_rds.cnx.commit() print('Done.')
def update_coords(db_rds, sample, commit=False): oper = ('SELECT X, Y, dX, dY, xm_mesa, ym_mesa, xm_pad, ym_pad, ' 'device_id ' 'FROM v04_device WHERE sample=%s') db_rds.exe(oper, (sample,)) dev_params = db_rds.fetchall() data = [] for p in dev_params: X_pad, Y_pad, X_mesa, Y_mesa = calc_coord(*p[:8]) device_id = p[8] data.append([X_pad, Y_pad, X_mesa, Y_mesa, sample, device_id]) oper = ('UPDATE device ' 'SET X_pad=%s, Y_pad=%s, X_mesa=%s, Y_mesa=%s ' 'WHERE sample=%s AND device_id=%s') print('update_coords: updating...') db_rds.exem(oper, data) if commit: db_rds.cnx.commit() print('Done.')