File tree 1 file changed +6
-4
lines changed
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -450,6 +450,7 @@ def dft(
450
450
dims = up_dim ,
451
451
coords = {up_dim : newcoords [up_dim ]},
452
452
) # taking advantage of xarray broadcasting and ordered coordinates
453
+ daft [up_dim ].attrs .update ({"direct_lag" : lag .obj })
453
454
454
455
if true_amplitude :
455
456
daft = daft * np .prod (delta_x )
@@ -539,8 +540,9 @@ def idft(
539
540
dim = [d for d in dim if d != real_dim ] + [
540
541
real_dim
541
542
] # real dim has to be moved or added at the end !
542
-
543
- if lag is not None :
543
+ if lag is None :
544
+ lag = [daft [d ].attrs .get ("direct_lag" , 0.0 ) for d in dim ]
545
+ else :
544
546
if isinstance (lag , float ) or isinstance (lag , int ):
545
547
lag = [lag ]
546
548
if len (dim ) != len (lag ):
@@ -549,8 +551,8 @@ def idft(
549
551
msg = "Setting lag with true_phase=False does not guarantee accurate idft."
550
552
warnings .warn (msg , Warning )
551
553
552
- for d , l in zip (dim , lag ):
553
- daft = daft * np .exp (1j * 2.0 * np .pi * daft [d ] * l )
554
+ for d , l in zip (dim , lag ):
555
+ daft = daft * np .exp (1j * 2.0 * np .pi * daft [d ] * l )
554
556
555
557
if chunks_to_segments :
556
558
daft = _stack_chunks (daft , dim )
You can’t perform that action at this time.
0 commit comments