# How to get the time domain of a pulse after an amplitude mask or a phase mask has been applied?

I am a chemist, and I am studying ultrafast spectroscopy. In these spectrscopies, usually a short (femtosecond) pulse of light is used to probe chemical reactions. Now, one of the topics in our lectures is predicting the shape of a pulse in the time domain after a mask (or filter) has been applied in the frequency domain (or wavelength). I had asked this question in physics.SE, but I believe I might find better answers here.

For example, this is an example from our lectures, where the amplitudes are changed in the frequency domain (here represented as wavelength) for a Gaussian input pulse. The output pulse is then drawn in the time domain again, and its shape is changed:

Another example is when a phase mask is applied on an input pulse:

In the lecture, my professor said that we would have to learn how to predict the shape of the output pulse by looking at the shape of the mask. As I understand, I would have to apply inverse Fourier transform to convert frequency domain to the time domain. However, I have no idea how to understand that intuitively. I am also unsure about the phase mask.

I know that that there are signal processing packages (e.g. in scipy) which deal with exactly this kind of thing. How do I use those to predict the shape of the output pulse from the shape of the amplitude filter or phase filter in the frequency domain? Additionally, if there is a way of understanding the Fourier transforms with masks/filters intuitively without using a software, I would like to know that.

You are correct that the (discrete) Fourier transform and its inverse are the correct way to calculate the waveforms. The basic ideas are covered in any signal processing textbook: if the input pulse is $$x[n]$$ and the filter impulse response is $$h[n]$$, then the filter output is $$y[n] = x[n] \ast h[n]$$, where $$\ast$$ is convolution. In the frequency domain, $$Y[f] = X[f] H[f]$$. I'll leave the details out and go on to the "intuition" that may allow you predict what will happen without math.

There is probably no substitute for experience when developing "intuition", so do a lot of exercises and try to find patterns. Here are some things to keep in mind:

• What is narrow in the frequency domain is spread out in the time domain, and vice versa.
• In consequence, filters tend to increase the duration of a signal, to "spread it out" in the time domain.
• Filters can also introduce "ringing", or ripples (you can see them in your first example above). If the frequency response of a filter has very sudden, steep changes, it will likely introduce ringing.
• All physical filters are causal, and this means that they will delay the input signal. How much, depends on how the filter is implemented; in general, the more selective the filter is, the more it will delay the input.
• Fourier theory is valid when the inputs are signals that have existed forever. Since pulses have short duration, you may expect to see "transient" responses. These deviate from what is predicted by Fourier, but last a very short time. To predict transients you need to use the Laplace transform.
• Linear phase filters don't distort the phase relationship between the different harmonic components of a pulse.
• On the other hand, non-linear phase filters will distort the pulse shape. This is probably the hardest aspect to develop an intuition for. If all filters you use are linear phase, you can ignore this.
• Thanks, this is quite helpful. Is there any software that I can use to get see the output pulse form by drawing (or coding) a filter in amplitude or phase? That would help me a lot in visualising. Also, you said in the answer that all physical filters delay the signal-- is there a type of filter that can do the reverse i.e. bring the signal forward in time? Because there is a lecture workshop question where the output signal is brought forward and I can't figure out what shape of filter could possibly do that. May 26, 2022 at 20:44
• Any numerical computing package should do the trick: SciPy, Octave, Matlab, Scilab... And if you could design a filter to do the reverse of a delay, you'd have a time machine! Any physical system can only react to past and present inputs.
– MBaz
May 26, 2022 at 20:50
• Is there a simple tutorial somewhere on the type of thing I am trying to do, using SciPy? I have used SciPy a lot, but only its statistics modules, and have no clue on how to do signal processing. Or if possible, could you show an example scipy code, for a type of mask I mentioned in the OP? That would help me a lot. May 27, 2022 at 9:45
• I have heard good things about "Think DSP", by A. Downey: open.umn.edu/opentextbooks/textbooks/290
– MBaz
May 27, 2022 at 12:43