• No results found

2.7 Practical application of the pulse shaper

2.7.2 Experimental setup

The software was written and tested so that genetic algorithm control of the pulse shaper, measurement of the THz pulse and calculation of the THz spectrum by FFT would all be integrated. The time taken to evaluate an individual supplied by the algorithm is determined primarily by the time taken to make a THz EOS scan. This can be adjusted within reason, in that the size and speed (i.e. the resolution) of the scan can be set. Since

Frequency (THz)

0 1 2 3 4 5

Spectral signal (normalised)

0.0 0.2 0.4 0.6 0.8 1.0 THz original

With pulse shaper

Figure 2.31: Figure 2.30 with the traces normalised for better comparison of the spectral content.

the frequency and time domains are related through a Fourier transform, de- creasing the time taken by reducing the size of the scan will reduce resolution in the spectrum. Increasing the speed will reduce the spectral width that can be accessed. Therefore it is necessary to balance the required spectral range and detail with the need to reduce the time taken for the genetic algorithm to reach a result within a reasonable time. After a number of tests a scan size of 2500 µm at a speed of 0.2 mm/s was decided to be an acceptable compromise. An example measurement taken using these settings is shown in Figure 2.32.

For the algorithm individuals of 1280×4096 were deemed to produce too large a universe and provide excessive detail for the current level of work. To reduce the universe size the element levels were set to 7-bit (i.e. 128 possible values, multiplied by 32 when applied to the pixels). It was determined by inspection that the spectrum from the laser source only filled 540 of the 640 available pixel pairs so the individuals were set to 540 in length with extra values added as padding when uploaded to the LCM. Finally, these initial

Frequency (THz)

0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5

Spectral signal (a.u.)

0 2e-6 4e-6 6e-6 8e-6 1e-5

Figure 2.32: Example spectrum taken with the LCM in place using the same EOS scan parameters as for the genetic algorithm. This provides a balance between speed of acquisition and spectral resolution.

experiments were carried out using phase-only pulse shaping (both masks loaded with the same data) to further reduce the universe. Given that it was established (Section 2.6.2) that the smallest number of evaluations to reach a given solution occurs when the population and the offspring proportion are comparatively low, a population of 20 with an offspring proportion of 30% was chosen. It was soon found that even with the various setting chosen as best to minimise the number of evaluations made in each generation, the process was time-consuming. A progress rate of 7–8 generations per hour was typical and runs were normally made overnight or over weekends. When evaluating a result returned at the end by the GA, care was always taken to compare it to a measurement made at the same time with a neutral setting of the LCM to eliminate changes in laser output as the cause of differences. Due to the time taken for the population to evolve a stopping point was usually decided by laboratory time constraints rather than any threshold value.

0.7 THz filtering

The first test was to produce a THz spectrum with a hole at 0.7 THz, similar to the physical filter of Figure 2.28. A perfect result would be a spectrum identical to the unshaped spectrum but with a gap at 0.7 THz, and one way to aim for this would be to gauge each mask by performing a root-mean-square subtraction of the measured spectrum from the desired. However, this can be a severely limiting solution and it is not even guaranteed that the THz spectrum can be controlled in this way. Instead the fitness was evaluated by comparing the spectral power at 0.7 THz with that at 0.5 THz and 0.9 THz with the aim being to maximise the differences between them (in the sense of reducing the 0.7 THz power). To reduce the effects of noise the evaluation for each individual was made by making five EOS measurements, averaging them and then performing an FFT. The FFT was normalised before the relative positions of the 0.7 THz to the 0.5 THz and 0.9 THz points were compared. The reason for normalising the FFT is because the effect wanted is suppression of the 0.7 THz as much as possible. If un-normalised FFTs were evaluated a spectrum with 60% reduction at 0.7 THz could be rated as better than one with 100% reduction but half the power. The GA settings were the same as given in Section 2.7.2.

Figure 2.33 shows the result from a 135 generation run. The spectra from the reference (unshaped) and mask (shaped) pulses have been normalised to each other.

A significant dip in the spectral power can clearly be seen but the dip is at 0.75 THz and not 0.7 THz as requested. The spectral power at 0.7 THz is in fact close to the unshaped result. Inspection of the code used to determine the fitness revealed the cause of the error. The spectrum was stored as an array and the elements representing 0.7 THz, 0.5 THz and 0.9 THz extracted. However, the incorrect index was used to address the array and so the points 0.75 THz, 0.55 THz and 0.95 THz were used instead with the fitness routine assessing the individuals according to their ability to minimise the 0.75 THz. In this respect, then, the actual result is a success.

Frequency (THz)

0.0 0.5 1.0 1.5 2.0 2.5 3.0

Spectral signal (normalised a.u.)

0.0 0.2 0.4 0.6 0.8 1.0 Original GA best mask

Figure 2.33: Comparison of the best mask returned by the genetic algo- rithm after 135 generations when attempting to produce a spectral hole at 0.7 THz. The hole is seen at 0.75 THz instead. This was found to be due to a programming error.

strength of the 0.7 THz signal and run again. The result from a 171 genera- tion run is shown in Figure 2.34. Here a definite dip can again be seen, but this time centred at 0.7 THz as requested.

1.5 THz filtering

To test the flexibility of the algorithm, it was run again but this time with the request for a dip at 1.5 THz. After 263 generations the best mask returned was used to produce the spectrum shown in Figure 2.35.

No dips are seen this time at 0.7 THz, suggesting that the results of the previous section were not a coincidence. Moreover, a clear dip is seen at

Frequency (THz)

0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0

Spectral signal (normalised a.u.)

0.0 0.2 0.4 0.6 0.8 1.0 Original GA best mask

Figure 2.34: Comparison of the best mask returned by the genetic algorithm after 171 generations when attempting to produce a spectral hole at 0.7 THz (indicated). A longer epoch was measured in the time domain to increase the spectral resolution.

1.5 THz, again as requested. The region between 0.9 THz and 1.3 THz looks lower as a whole, however, so the shaped result was rescaled to confirm the presence of the dip at 1.5 THz. This is shown in Figure 2.36, and demon- strates that the spectral power at 1.5 THz has indeed been reduced as a result of pulse shaping.

0.7 THz maximisation

The ability of the pulse shaper to increase power at a specified wavelength was also investigated. When deciding how to program the fitness routine appropriately the first approach was to simply maximise the 0.7 THz value.

Frequency (THz)

0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0

Spectral signal (normalised a.u.)

0.0 0.2 0.4 0.6 0.8 1.0 Original GA best mask

Figure 2.35: Comparison of the best mask returned by the genetic algorithm after 263 generations when attempting to produce a spectral hole at 1.5 THz (indicated).

This was not found to produce any suitable solutions, and it was speculated that, given that the spectrum is normalised, spectra where the THz power was minimal and thus dominated by noise could be mistaken for suitable solutions. Removing the normalisation (i.e. inspecting the absolute power at 0.7 THz) would be unlikely to provide a mask where there was any noticeable enhancement at 0.7 THz relative to the other powers. In this case the original spectrum, for instance, would be evaluated with higher fitness than a slightly lower powered spectrum with a strong peak at 0.7 THz.

As an alternative, the routine was amended to ascribe fitness to increased differences between 0.7 THz and 0.5 THz/0.9 THz in the favour of 0.7 THz. (Effectively a sign reversal of the evaluation used in Section 2.7.2.) The best

Frequency (THz)

0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0

Spectral signal (normalised a.u.)

0.0 0.2 0.4 0.6 0.8 1.0 Original Best mask

Figure 2.36: Figure 2.35 rescaled to match the powers in the 0.9–1.3 THz range. The reduced power at 1.5 THz (indicated) is still apparent.

mask achieved after 301 generations was used to produce the spectrum seen in Figure 2.37. It seems that the routine has done what was requested of it, but the result is not quite the effect hoped for. Rather than produce a strong peak at 0.7 THz, the spectral power at 0.9 THz has been reduced instead.