Ticket #3083 (closed: fixed)

Opened 9 years ago

Last modified 5 years ago

FFT derivatives of higher order

Reported by: Roman Tolchenov Owned by: Roman Tolchenov
Priority: major Milestone: Iteration 30
Component: Mantid Keywords:
Cc: Blocked By:
Blocking: Tester: Janik Zikovsky

Description


Change History

comment:1 Changed 9 years ago by Roman Tolchenov

(In [12030]) FFTDerivative can calculate higher order derivatives now. re #3083

comment:2 Changed 9 years ago by Roman Tolchenov

  • Status changed from new to accepted

comment:3 Changed 9 years ago by Roman Tolchenov

  1. If there is a shift in x linear interpolate to match the input x.
  2. Add checks that all spectra in the output have the same size.

comment:4 Changed 9 years ago by Nick Draper

  • Milestone changed from Iteration 29 to Iteration 30

Accepted and assigned tickets moved at iteration 29 code freeze

comment:5 Changed 9 years ago by Roman Tolchenov

(In [12959]) Made FFTDerivative return the output workspace of the same size as the input one. re #3083

comment:6 Changed 9 years ago by Roman Tolchenov

  • Status changed from accepted to verify
  • Resolution set to fixed

comment:7 Changed 9 years ago by Wenduo Zhou

  • Status changed from verify to verifying
  • Tester set to Wenduo Zhou

comment:8 Changed 9 years ago by Wenduo Zhou

I used the following script to test this ticket. According to wiki, FFT is just to do derivative to input data. Thus, as the input is Y = log(x), its first derivate is 1/x, and 2nd is -1/x2

But the result does not look like that. First the result of FFTDerivatvie to y=ln(x) at order 1 is close to 1/x, but the data points are not smooth but oscillate. Then its 2nd derivate is way off. Here is my test script:

# Test 3083 FFTDerivative

datax = []

datay = []

datae = []

size = 1000

dx = 0.01

x0 = 0.5

import math

for i in xrange(size):

x = i*dx+x0

y = math.log(x)

e = 1.0

datax.append(x)

datay.append(y)

datae.append(e)

CreateWorkspace("Data", datax, datay, datae, 1, "")

FFTDerivative(InputWorkspace="Data", OutputWorkspace="DataDx1", Order=1)

FFTDerivative(InputWorkspace="Data", OutputWorkspace="DataDx2", Order=2)

FFTDerivative(InputWorkspace="DataDx1", OutputWorkspace="DataDxDx", Order=1)

comment:9 Changed 9 years ago by Wenduo Zhou

  • Status changed from verifying to reopened
  • Resolution fixed deleted

comment:10 Changed 9 years ago by Roman Tolchenov

  • Status changed from reopened to accepted

For FFTDerivative to work well the function must be either periodic or going to zero at +- infinity. I am making an attempt to minimise the edge effects by symmetrising the data before FFT. But they cannot be eliminated completely. I would say the algorithm is doing a good job with log(x) :-)

comment:11 Changed 9 years ago by Roman Tolchenov

  • Status changed from accepted to verify
  • Resolution set to fixed

comment:12 Changed 9 years ago by Janik Zikovsky

  • Status changed from verify to verifying
  • Tester changed from Wenduo Zhou to Janik Zikovsky

comment:13 Changed 9 years ago by Janik Zikovsky

  • Status changed from verifying to closed

Derivative of sin(x) looks like cos(x). 2nd degree looks like -sin(x). Passed.

# Test 3083 FFTDerivative

datax = []
datay = []
datae = []
size = 1000
dx = 0.02
x0 = 0.0

import math

for i in xrange(size):
    x = i*dx+x0
    y = math.sin(x)
    e = 1.0
    datax.append(x)
    datay.append(y)
    datae.append(e)

CreateWorkspace("Data", datax, datay, datae, 1, "")
FFTDerivative(InputWorkspace="Data", OutputWorkspace="DataDx1", Order=1)
FFTDerivative(InputWorkspace="Data", OutputWorkspace="DataDx2", Order=2)
FFTDerivative(InputWorkspace="DataDx1", OutputWorkspace="DataDxDx", Order=1) 

comment:14 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 3930

Note: See TracTickets for help on using tickets.