fusion-flap / flap

Fusion Library of Analysis Programs
MIT License
11 stars 5 forks source link

CCF fails #61

Closed thelampire closed 4 years ago

thelampire commented 4 years ago

Cross-correlation function calculation fails with the following two object if the np.dtype=float16 or float64

GPI_SLICED_FILTERED(data_source:"NSTX_GPI" exp_id:"139901") data_title:"NSTX GPI data" shape:[2783,64,80][no error] Data name:"Signal", unit:"Digit" Coords: Time s [<R. symm.>] Start: 3.000E-01, Steps: 2.515E-06 Sample n.a. [<R. symm.>] Start: 1.988E+04, Steps: 1.000E+00 Image x Pixel [<R. symm.>] Start: 0.000E+00, Steps: 1.000E+00 Image y Pixel [<R. symm.>] Start: 0.000E+00, Steps: 1.000E+00 Device R mm [<R. symm.>] Start: 1.403E+03, Steps: 3.718E+00, -7.782E-01 Device z mm [<R. symm.>] Start: 7.054E+01, Steps: 1.809E-01, 3.066E+00

GPI_REF(data_source:"NSTX_GPI" exp_id:"139901") data_title:"NSTX GPI data" shape:[2783][no error] Data name:"Signal", unit:"Digit" Coords: Time s [<R. symm.>] Start: 3.000E-01, Steps: 2.515E-06 Sample n.a. [<R. symm.>] Start: 1.988E+04, Steps: 1.000E+00 Image x [Pixel](Dims:, Shape:[1]) [<R. symm.>] Val:10 Image y [Pixel](Dims:, Shape:[1]) [<R. symm.>] Val:40 Device R [mm](Dims:, Shape:[1]) [<R. symm.>] Val: 1.409E+03 Device z [mm](Dims:, Shape:[1]) [<R. symm.>] Val: 1.950E+02

I am running the following code:

    flap.ccf('GPI_SLICED_FILTERED',exp_id=exp_id,
              ref=reference_signal,
              coordinate='Time',
              options={'Resolution':taures,
                       'Range':taurange,
                       #'Trend':['Poly',2],
                       'Trend':None,
                       'Interval':interval_n,
                       'Normalize':normalize,
                       },
               output_name='GPI_CCF')

Where taures=10e-6 taurange=[-500e-6,500e-6] interval_n=1

It seems to be working with int16 data.

thelampire commented 4 years ago

Also, with the int16 data, the resulting cross-correlation functions look like triangles:

Screen Shot 2019-11-13 at 8 11 05 PM

This may be my fault, but I'd be curious where could this come from. If I don't normalize it, it looks the same but with a different peak value.

thelampire commented 4 years ago

My bad, it is the filtering + low taurange.