jdtuck / fdasrsf_python

elastic fda python code
http://research.tetonedge.net
BSD 3-Clause "New" or "Revised" License
51 stars 18 forks source link

Scaling and offset issue when computing q_to_curve(curve_to_q) #49

Closed aa89113 closed 5 months ago

aa89113 commented 5 months ago

Computing q_to_curve from curve_to_q result produces different result than original curve:

original_curve = beta[:, :, 0]
curve_to_q_to_curve_result = cf.q_to_curve(cf.curve_to_q(beta=original_curve)[0]) 
curve_to_q_to_curve_result - original_curve```

Output:
array([[ 0.47009756,  0.47020939,  0.47020472, ..., -0.18782491,
        -0.18784627, -0.18786339],
       [ 0.4804878 ,  0.47816416,  0.47626143, ...,  0.47862544,
         0.48014762,  0.4812489 ]])

Thanks a lot for your help

aa89113 commented 5 months ago

Usiing something like this, it fixes the scaling, but there is still a translation difference between the original and reconstructed data:

original_curve = beta[:, :, 0]
curve_to_q_result = curve_to_q(beta=original_curve, scale=True)
curve_to_q_to_curve_result = q_to_curve(curve_to_q_result[0], scale=curve_to_q_result[2])