-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
def transform_units(data, dt=dt, scaling=scaling):
'''
Transforms units of the data from pixels and pixels/dt to
meters and meters/second
ScalePix=1/59.03942 #[pix] to [mm]
ScaleV=0.001*(ScalePix)/(5*10**-5) # [pix/dt] to [m/sec]
xf=ScalePix*np.arange(16,1012,4) # pixels/59.03942 => mm
X=ScalePix*np.reshape(x,shape)
Y=ScalePix*np.reshape(y,shape)-yoffset
U=ScaleV*np.nanmean(u,axis=2)
V=ScaleV*np.nanmean(v,axis=2)
Note that we got scaling factors in the Excel document
where scaling is the opposite I guess
47 pix/mm for 25.04
61 pix/mm for 11.04
We also list dt in seconds, 1/10000 fps = 0.0001 seconds
Note that single pulse case is at 10,000 fps, while
Victor used double pulse at equivalent 20,000 fps with half as
many pairs as we have.
'''
# transformation is all in memory, overwriting the
# existing object, if you need a copy, add
# tmp = data.copy()
# and work with tmp, not with data
# this function also destroys the ['w'] property.
# do it before estimating the scalar.
# mm->pix, mm->m, m/dt -> m/s
velocity_scaling = 0.001 * (1/scaling) * (1/dt)
data['x'] = data['x'] * (1/scaling)
data['y'] = data['y'] * (1/scaling)
data['u'] = data['u'] * velocity_scaling
data['v'] = data['v'] * velocity_scaling
data.attrs['units'] = ['m','m','m/s','m/s']
return data
Metadata
Metadata
Assignees
Labels
No labels