OptFROG – Analytic signal spectrograms with optimized time-frequency resolution

OptFROG – Analytic signal spectrograms with optimized time-frequency resolution

O. Melchert oliver.melchert@hot.uni-hannover.de B. Roth U. Morgner A. Demircan Hannover Centre for Optical Technologies (HOT), 30167 Hannover, Germany Institute of Quantum Optics (IQO), Leibniz Universität Hannover, 30167 Hannover, Germany
Abstract

A Python package for the calculation of spectrograms with optimized time and frequency resolution for application in the analysis of numerical simulations on ultrashort pulse propagation is presented. Gabor’s uncertainty principle prevents both resolutions from being optimal simultaneously for a given window function employed in the underlying short-time Fourier analysis. Our aim is to yield a time-frequency representation of the input signal with marginals that represent the original intensities per unit time and frequency similarly well. As use-case we demonstrate the implemented functionality for the analysis of simulations on ultrashort pulse propagation in a nonlinear waveguide.

keywords:
Spectrogram, Short-time Fourier analysis, Analytic signal, Optics, Ultrashort pulse propagation
journal: SoftwareX

1 Motivation and significance

The spectrogram, providing a particular time-frequency representation of signals that vary in time Cohen:1989 (), represents an inevitable tool in the analysis of the characteristics of ultrashort optical pulses. E.g., allowing to monitor the change in frequency of pulse features as function of time permits to determine quantities that cannot be obtained from either the time or frequency domain representation of the optical pulse alone. The applicability of the spectrogram to both, data retrieved from experiments Trebino:1993 (); Linden:2000 (); Trebino:2000 (); Efimov:2005 () where it is referred to as frequency resolved optical gating (FROG) analysis, as well as from numerical simulations Dudley:2002 (); Skryabin:2005 (); Guo:2013 (), carried out to complement experiments and to provide a basis for the interpretation of the observed effects, highlights the relevance of signal processing in the field of nonlinear optics and demonstrates the need to be able to compute such spectrograms in the first place. Here, we consider the issue of obtaining optimal time-frequency representations of signals for the interpretation of numerical experiments on ultrashort pulse propagation in nonlinear waveguides.

In principle, a spectrogram measures the properties of the signal under scrutiny as well as those of a user-specified window function for localizing parts of the signal during analysis. Exhibiting features of both, the interpretation of the spectrogram is strongly affected by the particular function used for windowing. Different window functions estimate different signal properties, e.g., if a given function achieves a good approximation of the intensities per unit time of the underlying signal, its approximation of the intensities per unit frequency might be bad. Consequently, the spectrogram might suffer from distortion yielding an unreasonable characterization of the time-frequency features of the signal under scrutiny. The usual approach for deciding on a particular window function is by trial-and-error and guided by the liking and experience of the individual.

Here we present a software tool that aims at minimizing the mismatch between the intensities per unit time and frequency and their corresponding estimates based on the spectrogram itself, obtained for a user-supplied parameterized window function. The resulting spectrograms are “optimal” in the sense that their visual inspection exhibits a minimal amount of distortion and thus allow for a reliable interpretation of the time-frequency composition of the input signal. Such an approach was previously shown to result in a reasonable characterization of the underlying time-frequency features Cohen:2003 (). It is further independent of the experience of the individual user and thus yields reproducible results.

2 Software description

The presented package facilitates the construction of spectrograms for the analytic signal (AS) Gabor:1947 () of the real field . In the Fourier domain, the angular frequency components of both are related via Marple:1999 (). Due to its one-sided spectral definition the time-domain representation of the AS is complex, further satisfying . The construction of an AS spectrogram relies on the repeated calculation of the spectrum of the modified signal at different delay times in terms of the short-time Fourier transform

(1)

wherein specifies a narrow window function centered at and decaying to zero for increasing . The latter allows to selectively filter parts of the AS and to estimate its local frequency content. Scanning over a range of delay times then yields the spectrogram as , providing a joint time-frequency distribution of both, the AS and the window function WignerNote (). For assessing the approximation quality of we utilize its time and frequency marginals

(2)
(3)

Note that in the limit where approaches a delta function, the time marginal will approach the intensity per unit time but the frequency marginal will represent the intensity per unit frequency only poorly. As a result, time resolution will be good and frequency resolution will be bad, see the discussion in section 3 below. The time-frequency uncertainty principle prevents both resolutions from being optimal simultaneously Cohen:1989 ().

The aim of the presented package is to obtain a time-frequency representation of the input signal for which the integrated absolute error (IAE) between its normalized marginals and the original intensities per unit time and frequency are minimal. We consider a single parameter window function , e.g. a Gaussian function with mean and root-mean-square (rms) width , and solve for

(4)

Above, the underlying spectrogram is computed via , indicated by the superscript on the marginals, and we assume normalization to and a total signal energy in terms of the spectrogram. For a good agreement of the marginals and the original intensities, the objective function assumes a small value. The additional parameter might be adjusted to give more weight to frequency resolution () or time resolution () if appropriate. The particular choice yields a balanced time-frequency representation, see the example provided in section 3. The optimized spectrogram is then computed by using for windowing.

2.1 Software Architecture

OptFROG, following the naming convention PEP8 () for Python packages implemented as optfrog, uses the Python programming language Rossum:1995 () and depends on the functionality of numpy and scipy Scipy (). It further follows a procedural programming paradigm.

2.2 Software Functionalities

The current version of optfrog comprises five software units having the subsequent responsibilities:

vanillaFrog

Compute a standard spectrogram for the normalized time-domain analytic signal for a particular window function .

optFrog

Compute a time-frequency resolution optimized spectrogram for the normalized time-domain analytic signal using the window function that minimizes the total IAE of both marginals. Note: for the minimization of the scalar function in the variable , the scipy native function scipy.optimize.minimize_scalar is employed in bounded mode.

timeMarginal

Compute the marginal distribution in time based on the spectrogram.

frequencyMarginal

Compute the marginal distribution in frequency based on the spectrogram.

totalEnergy

Compute the total energy provided by the spectrogram approximation of the time-frequency characteristics of the signal.

For a more detailed description of function parameters and return values we refer to the documentation provided within the code optfrog_GitHub:2018 ().

Figure 1: Analytic signal spectrograms allowing for the time-frequency characterization of a real optical field obtained from the numerical propagation of an ultrashort pulse in an photonic crystal fiber. (a) vanillaFrog-trace for a Gaussian window function with rms-width , (b) balanced optFrog-trace for , and, (c) vanillaFrog-trace for a Gaussian window function at .

2.3 Sample code snippet

In our research work we use optfrog mainly in script mode. An exemplary data postprocessing script, reproducing Fig. 1(b) discussed in section 3 below, is shown in listing 1. Therein, after importing the functionality of numpy, optfrog, and a custom figure generating routine in lines 1–3, the location of the input data (line 5) and filter options for the spectrogram output-data (lines 6p) are specified. Note that the user defined window function (lines 9p) does not need to be normalized. After loading the input data (lines 12p) the routine optFrog is used to compute an optimized spectrogram in line 15. Finally, a visual account of the latter is prepared by the routine spectrogramFigure in line 17.

1import numpy as np
from optfrog import optFrog
3from figure import spectrogramFigure
5fName = ’./data/exampleData_pulsePropagation.npz’
tPars = (-500.0, 5800.0, 10)
7wPars = (  0.75,   3.25,  3)
9def wFunc(s0):
    return lambda x: np.exp(-x**2/2/s0/s0)
11
data = np.load(fName)
13t, Et = data[’t’], data[’Et’]
15res = optFrog(t,Et,wFunc,tLim=tPars,wLim=wPars)
17spectrogramFigure((t,Et),res)
Listing 1: Exemplary Python script using optfrog for the calculation of a time-frequency resolution optimized spectrogram.

3 Illustrative Examples

So as to demonstrate the functionality of optfrog we consider the numerical propagation of a short and intense few-cycle optical pulse in presence of the refractive index profile of an “endlessly single mode” () photonic crystal fiber Birks:1997 (); Stone:2007 (). The underlying unidirectional propagation model includes the Kerr effect and a delayed Raman response of Hollenbeck-Cantrell type Hollenbeck:2002 (). For the preparation of the initial condition we considered a single soliton with duration , i.e. approximately cycles, and soliton order , prepared at a center frequency . See Refs. Amiranashvili:2010b (); Amiranashvili:2011 () for a detailed account of the propagation model and Ref. Melchert:2018 () for a more thorough discussion of the particular problem setup. In Fig. 1 we illustrate the time-frequency characteristics of the pulse at propagation distance by using a Gaussian window function centered at and having rms-width . Note that the delay time has to be interpreted as being relative to the origin of a co-moving frame of reference in which the soliton is initially at rest.

In Figs. 1(a,c) we demonstrate an inevitable drawback of a trial-and-error choice of a window function used for calculating a spectrogram. As discussed earlier, the properties of the window implies a trade-off in resolution that might be achieved. I.e., if the user opts for a window function that is either too wide or too narrow in comparison to the signal features in the time domain, only one marginal will approximate its underlying original intensity well and, as a result, the spectrogram will appear distorted. This is shown in Fig. 1(a), where a vanillaFrog trace using demonstrates a good frequency resolution and a bad time resolution. Conversely, as evident from Fig. 1(c), a vanillaFrog trace using yields a good time resolution and a bad frequency resolution. In contrast, if the IAEs of both marginals are minimized simultaneously by aid of a numerical algorithm, both marginals of the optimized spectrogram are found to approximate the original intensities per unit time and frequency similarly well. Consequently, the resulting spectrogram provides a most reasonable time-frequency representation of the underlying signal. To demonstrate this, the balanced () optFrog trace for the optimized window function, obtained for with , is shown in Fig. 1(b).

4 Impact

Computing reliable spectrograms represents an integral part in the analysis of the characteristics of ultrashort optical pulses. The publicly available and free Python package optfrog performs the nontrivial task of computing such spectrograms with optimized time-frequency resolution. It is based on a computational approach to parameter optimization in opposition to common trial-and-error approaches, helping to save time and effort and yielding reproducible results independent of the skill of the individual user. It addresses researchers in the field of ultrashort pulse propagation and related disciplines where signal analysis in terms of short-time Fourier transforms is of relevance. As independent software postprocessing tool it is ideally suited for the analysis of output data obtained by existing pulse propagation codes, as, e.g., the open source LaserFOAM (Python) Amorim:2009 () and gnlse (Matlab) Travers:2010 () solver for the generalized nonlinear Schrödinger equation.

5 Conclusions

The optfrog Python package provides easy-to-use tools that yield a time-frequency representation of a real valued input signal and allow to quantify how well the resulting spectrogram approximates the signal under scrutiny for a user supplied window function.

We have shown how optfrog can be used to calculate analytic signal based spectrograms that are optimal in the sense that their visual inspection exhibits a minimal amount of distortion, allowing for a reliable interpretation of the time-frequency composition of the input signal.

The optfrog software tool, including scripts that implement the exemplary use-cases illustrated in section 3, is available for download and installation under Ref. optfrog_GitHub:2018 ().

Acknowledgements

We acknowledge support from the VolkswagenStiftung within the Niedersächsisches Vorab program (HYMNOS; Grant ZN 3061) and Deutsche Forschungsgemeinschaft (Grand MO 850/20-1).

References

References

  • (1) L. Cohen. Time-Frequency Distributions – A Review. Procedings of the IEEE, 77:941–981, 1989.
  • (2) D. J. Kane and R. Trebino. Characterization of Arbitrary Fremtosecond Pulses Using Frequency-Resolved Optical Gating. IEEE J. Quantum Electron., 29:571, 1993.
  • (3) S. Linden, J. Kuhl, and H. Giessen. Frequency-Resolved Optical Gating: The Measurement of Ultrashort Laser Pulses, chapter XFROG—Cross-correlation Frequency-resolved Optical Gating, pages 313–322. In Trebino Trebino:2000 (), 2000.
  • (4) R. Trebino, editor. Frequency-Resolved Optical Gating: The Measurement of Ultrashort Laser Pulses. Springer US, Boston, MA, 2000.
  • (5) A. Efimov, A. V. Yulin, D. V. Skryabin, J. C. Knight, N. Joly, F. G. Omenetto, A. J. Taylor, and P. Russell. Interaction of an Optical Soliton with a Dispersive Wave. Phys. Rev. Lett., 95:213902, 2005.
  • (6) J. M. Dudley, X. Gu, L. Xu, M. Kimmel, E. Zeek, P. O’Shea, R. Trebino, S. Coen, and R. S. Windeler. Cross-correlation frequency resolved optical gating analysis of broadband continuum generation in photonic crystal fiber: simulations and experiments. Opt. Express, 10(21):1215–1221, 2002.
  • (7) D. V. Skryabin and A. V. Yulin. Theory of generation of new frequencies by mixing of solitons and dispersive waves in optical fibers. Phys. Rev. E, 72:016619, 2005.
  • (8) H. Guo, S. Wang, X. Zeng, and M. Bache. Understanding Soliton Spectral Tunneling as a Spectral Coupling Effect. IEEE Photonics Technology Letters, 25(19):1928, 2013.
  • (9) L. Cohen and P. J. Loughlin. The marginals and time-frequency distributions. In Proc. SPIE 5205, Advanced Signal Processing Algorithms, Architectures, and Implementations XIII, page 59, 2003.
  • (10) D. Gabor. Acoustical Quanta and the Theory of Hearing. Nature, 159:591 – 594, 1947.
  • (11) S. L. Marple. Computing the discrete-time ”analytic” signal via FFT. IEEE Trans. Signal Processing, 47:2600–2603, 1999.
  • (12) Alternatively, the optical pulse might be expressed in terms of its Wigner distribution Cohen:1989 (), i.e. a quasi-probability distribution having the correct time and frequency marginals already. However, due to its similarity to the XFROG-traces retrieved from experiments in order to analyse optical pulses, our discussion here is focused on the spectrogram.
  • (13) G. van Rossum, B. Warsaw, and N. Coghlan. PEP8 – Style Guide for Python Code. https://www.python.org/dev/peps/pep-0008, 2001. [Online; accessed 2018-06-27].
  • (14) G. Rossum. Python Reference Manual. Technical report, Amsterdam, The Netherlands, The Netherlands, 1995.
  • (15) E. Jones, T. Oliphant, P. Peterson, et al. SciPy: Open source scientific tools for Python. http://www.scipy.org/, 2001–2018. [Online; accessed 2018-04-06].
  • (16) O. Melchert. optfrog – Analytic signal spectrograms with optimized time-frequency resolution. https://github.com/omelchert/optfrog.git, 2018. [Online; accessed 2018-06-20].
  • (17) T. A. Birks, J. C. Knight, and P. St. J. Russell. Endlessly single-mode photonic crystal fiber. Opt. Lett., 13:961–963, 1997.
  • (18) J. M. Stone and J. C. Knight. Visibly ’white’ light generation in uniform photonic crystal fiber using a microchip laser. Optics Express, 16:2670, 2007.
  • (19) D. Hollenbeck and C. D. Cantrell. Multiple-vibrational-mode model for fiber-optic Raman gain spectrum and response function. J. Opt. Soc. Am. B, 19:2886, 2002.
  • (20) Sh. Amiranashvili and A. Demircan. Hamiltonian structure of propagation equations for ultrashort optical pulses. Phys. Rev. A, 82:013812, 2010.
  • (21) Sh. Amiranashvili and A. Demircan. Ultrashort Optical Pulse Propagation in terms of Analytic Signal. Advances in Optical Technologies, 2011:989515, 2011.
  • (22) O. Melchert, U. Morgner, B. Roth, I. Babushkin, and A. Demircan. Accurate propagation of ultrashort pulses in nonlinear waveguides using propagation models for the analytic signal. In Proc. SPIE 10694, Computational Optics II, page 106940M, 2018.
  • (23) A. A. Amorim, M. V. Tognetti, P. Oliveira, J. L. Silva, L. M. Bernardo, F. X. Kärtner, and H. M. Crespo. Sub-two-cycle pulses by soliton self-compression in highly nonlinear photonic crystal fibers. Opt. Lett., 34(24):3851–3853, 2009.
  • (24) J. C. Travers, M. H. Frosz, and J. M. Dudley. Supercontinuum Generation in Optical Fibers, chapter Nonlinear fibre optics overview. Cambridge University Press, 2010.

Required Metadata

Current code version

Ancillary data table required for subversion of the codebase. Kindly replace examples in right column with the correct information about your current code, and leave the left column as it is.

Nr. Code metadata description Please fill in this column
C1 Current code version 1.0.0
C2 Permanent link to code/repository used for this code version https://github.com/omelchert/optfrog.git
C3 Legal Code License MIT License
C4 Code versioning system used none
C5 Software code languages, tools, and services used Python, GitHub
C6 Compilation requirements, operating environments & dependencies The optfrog package requires Python, numpy and scipy. The installation process requires Pythons setuptool package and the provided use-cases need Pythons matplotlib for figure generation.
C7 If available Link to developer documentation/manual Documentation provided within code
C8 Support email for questions oliver.melchert@hot.uni-hannover.de
Table 1: Code metadata (mandatory)
Comments 0
Request Comment
You are adding the first comment!
How to quickly get a good reply:
  • Give credit where it’s due by listing out the positive aspects of a paper before getting into which changes should be made.
  • Be specific in your critique, and provide supporting evidence with appropriate references to substantiate general statements.
  • Your comment should inspire ideas to flow and help the author improves the paper.

The better we are at sharing our knowledge with each other, the faster we move forward.
""
The feedback must be of minimum 40 characters and the title a minimum of 5 characters
   
Add comment
Cancel
Loading ...
362689
This is a comment super asjknd jkasnjk adsnkj
Upvote
Downvote
""
The feedback must be of minumum 40 characters
The feedback must be of minumum 40 characters
Submit
Cancel

You are asking your first question!
How to quickly get a good answer:
  • Keep your question short and to the point
  • Check for grammar or spelling errors.
  • Phrase it like a question
Test
Test description