def ts_from_list(A, B, C, T, initype, sA=[], sB=[], sC=[], stat='STAT', name='NoName'): tsout = time_series.TimeSeriePoint() if len(sA) == 0: for a, b, c, t in zip(A, B, C, T): pt = time_series.Point(a, b, c, t, initype) tsout.add_point(pt) else: for a, b, c, t, sa, sb, sc in zip(A, B, C, T, sA, sB, sC): pt = time_series.Point(a, b, c, t, initype, sa, sb, sc) tsout.add_point(pt) tsout.stat = stat tsout.name = name if initype == 'ENU': tsout.boolENU = True else: tsout.boolENU = False return tsout
def rotate_pt_cls_solo(tsattin, pointin, Rtype='R1', xyzreftuple=([1, 0, 0], [0, 1, 0], [0, 0, 1]), angtype='deg'): ''' ENTREE : tsattin : une TS d'attitude (N angles) pointin : UN Point en entrée SORTIE : une TSpoint de N points ''' attlisttmp = tsattin.to_list() R = attlisttmp[0] P = attlisttmp[1] Y = attlisttmp[2] T = attlisttmp[3] A, B, C, _, _ = pointin() ptrotlis = XXX.rotate_points(R, P, Y, [np.array([A, B, C])], Rtype, xyzreftuple, angtype) ptrotlis = utils.shrink_listoflist(ptrotlis) tsout = time_series.TimeSeriePoint() for p, t in zip(ptrotlis, T): #print p tsout.add_point( time_series.Point(p[0], p[1], p[2], t, initype=pointin.initype)) return tsout
def mean_list_of_pts(ptslisin): """ useful for merge fct ONLY IMPLEMENTED FOR ENU coords for the moment """ E = np.nanmean([p.E for p in ptslisin]) N = np.nanmean([p.N for p in ptslisin]) U = np.nanmean([p.U for p in ptslisin]) sE = np.nanmean([p.sE for p in ptslisin]) sN = np.nanmean([p.sN for p in ptslisin]) sU = np.nanmean([p.sU for p in ptslisin]) Tlis = [p.T for p in ptslisin] T = ((np.max(Tlis) - np.min(Tlis)) / 2.) + np.min(Tlis) pt = time_series.Point(E, N, U, T, 'ENU', sE, sN, sU, ptslisin[0].name) return pt
def refENU_for_tslist(tslist_in, tsref_marker=0): """ tsref_marker : indice of the reference time serie OR the 'all' keyword in this case all the time series mean position will be averaged """ if tsref_marker == 'all': refENU_stk = [] for ts in tslist_in: refENUtmp = ts.mean_posi() refENU_stk.append(refENUtmp) X = np.mean([renu.X for renu in refENU_stk]) Y = np.mean([renu.Y for renu in refENU_stk]) Z = np.mean([renu.Z for renu in refENU_stk]) refENU = time_series.Point(X, Y, Z, 0, initype='XYZ') else: refENU = tslist_in[tsref_marker].mean_posi() for ts in tslist_in: ts.ENUcalc(refENU) return refENU