1 Introduction

Terahertz technology has attracted considerable interest for a range of application scenarios. Among these applications are the detection of explosives [1,2,3] in the security sector and industrial implementations, for example, in automotive [4], paper [5] and pharmaceutical [6, 7] production lines. Building on the pharmaceutical sector, early terahertz-based spectroscopic studies were mainly focused on the study of crystal structure of drug molecules due to the ability of the terahertz radiation to probe intermolecular vibrations between hydrogen bonded molecules [8]. As a result, exhaustive terahertz-based studies have been reported on crystalline material identification [9,10,11,12,13], drug polymorph and hydrate form identification [14,15,16,17,18,19,20], as well as the degree of crystallinity of drug substance [21,22,23,24,25].

By adopting the reflection configuration and exploiting the time-domain nature of modern terahertz instrumentation, several imaging-based studies (terahertz pulsed imaging, TPI) aimed at non-destructive inspection of tablets have seen considerable interest [7, 26,27,28,29,30,31,32]. The application of TPI for assessing coating uniformity of pharmaceutical tablets [7, 26,27,28] has been successfully demonstrated for both lab-based [26, 33] and production-scale in-line applications [34].

Besides the numerous terahertz imaging applications that are mostly operated in reflection mode, pharmaceutical applications based on the use of the THz-TDS in transmission configuration remained relatively unexploited until around a decade ago when Peiponen and his group showed the interplay between the porous matrix and the optical properties of tablets [35]. The work demonstrated that there is a linear correlation between the bulk refractive index and the porosity of pharmaceutical tablets, which can be exploited through the so-called zero-porosity approximation (ZPA) as a method for measuring tablet porosity. In an attempt to accurately determine the optical properties of a tablet using THz-TDS, Parrot et al. [36] were among the first to adopt the concept of the effective medium approximation, i.e. the Maxwell-Garnett model, to calculate the optical coefficients of tablets. Just about the same time, Tuononen et al. [37] highlighted the interplay between the effective complex permittivity and the porosity of simple two-phase tablets using the concept of the Wiener bounds [38]. The Wiener bounds give the extreme limits, i.e. upper and lower bounds/limits, of the effective permittivity of the tablets. The upper bound indicates an ideal parallel arrangement of the solid material and air voids with respect to direction of the THz electric field whereas the lower bound represents an ideal serial arrangement [39]. These two studies triggered a number of completely new ways of assessing the quality of pharmaceutical tablet using THz-TDS.

Around the mid 2010s, Bawuah et al. [40] successfully demonstrated that THz-TDS in conjunction with the Bruggeman effective medium approximation can be used to non-destructively and non-invasively measure the porosity of pharmaceutical tablets. In that preliminary study, the authors adopted the Bruggeman model due to its validity for tablets with a wide range of porosity. Despite its basic assumption that the inclusions are of spherical shape, the Bruggeman model could be used to accurately measure the porosity of flat-faced compacts containing only microcrystalline cellulose (MCC) and air [40]. Following the success of this study, follow-up studies were conducted using tablets with a range of degree of complexity in terms of their formulations (tablets composed of more than one excipients and an active pharmaceutical ingredient, API) [41] and shapes [42, 43]. Based on the fast, non-invasive and non-destructive nature of the terahertz porosity measurement approach, the authors proposed possible at-line and in-line applications during tablet manufacturing. Compared with conventional but destructive porosity measurement methods like mercury porosimetry, the terahertz method has the additional merit of being able to probe isolated pores in the core of the matrix. Such pores are quite challenging to detect by conventional porosimetry methods that typically rely on accessing the pores from the outside of the porous medium for the measurement.

In subsequent studies, Markl el al. [44] showed that the assumption of the spherical inclusion in the Bruggeman effective medium approximation (from now onwards known as the traditional Bruggeman effective medium approximation, TB-EMA) can limit the accurate prediction of the effective refractive index when tablets containing API and those composed of a highly porous excipient, such as functionalised calcium carbonate, are tested. This led to the adoption of the anisotropic Bruggeman effective medium approximation (AB-EMA), which takes into consideration the presence of non-spherical inclusions within a tablet. The ability to predict the pore shape based on the AB-EMA model led to a stream of follow-up studies that sought to critically analyse the pore structure of pharmaceutical tablets using THz-TDS [39, 44,45,46]. A detailed description of pore structure analyses of tablets will be reported in a future tutorial paper.

Finally, we want to highlight that the insights on tablets using THz-TDS outlined above are fundamentally based on two unique properties of the terahertz radiation: (1) the relatively long wavelength of terahertz radiation in comparison to the typical particle sizes of materials that are used to make tablets results in low scattering losses, and (2) the ability of the terahertz radiation to permeate a wide range of polymers and ceramic materials that commonly serve as excipients in pharmaceutical tablets.

The current tutorial seeks to systematically take the reader through the steps required for the THz-TDS approach to non-invasively measure the total porosity of pharmaceutical tablets. Several batches of flat-faced and biconvex ibuprofen-based tablets are used to illustrate the concepts in a case study. By using tablets with different geometries the various approaches involved in the terahertz porosity method are compared and contrasted. The reasons for when and how to adopt a specific approach are outlined based on material properties, the complexity of the tablet formulations and the geometry of the tablets in concern.

Finally, we want to emphasise that the use of the terahertz porosity method on any batches of tablets compressed from a given formulation will ideally require an initial set of flat-faced tablets of the same formulation that are compressed at different porosity levels. Our recommendation is to have at least five porosity levels that cover the entire range of expected porosity values. The use of flat-faced tablets, aside from being simple and easy to compact, will ensure accurate material parameter estimation of the intrinsic refractive index of the solid matrix.

2 Terahertz Time-Domain Spectroscopy

A typical terahertz time-domain spectrometer has four major components: a femtosecond pulsed NIR laser, the terahertz emitter (photoconductive antenna), a delay mechanism between a pump and probe beam and a time-gated detector. Sub-picosecond coherent pulses of broadband terahertz radiation are generated based on the principle of photoexcitation [22]. The photoconductive antenna (PCA) is basically made of a fast optically activated switch that is embedded in an antenna structure (e.g. DC biased semi-insulating GaAs substrate). The emitted coherent terahertz pulse is guided via an assembly of off-axis parabolic or ellipsoid mirrors and focused on the sample after which the transmitted waveform is detected either by a similar PCA detector [47] or by an electro-optic (EO) sampling technique [48, 49]. With THz-TDS the electric field, which encompasses both the amplitude and phase of the radiation, is measured and hence gives direct access to the complex refractive index of materials. The ability to directly access the complex refractive index makes THz-TDS advantageous compared with other far-infrared spectroscopic techniques like conventional Fourier-transform spectroscopy.

2.1 Measurements and Data Acquisition Routines

Data acquisition using THz-TDS is typically carried out with the sample in either a reflection or transmission geometry depending on the objectives of the experiment to be conducted, and the absorption properties of the material used. In order to measure the porosity of a pharmaceutical tablet measurements are typically performed in a transmission geometry given the transparency of most excipients that are used to make tablets. Figure 1a illustrates the transmission configuration, where a tablet is placed at the focal point of the terahertz beam and the transmitted signal is detected.

Fig. 1
figure 1

An illustration of reference and sample transmission measurement routine

In this tutorial, the transmitted terahertz pulse through a pharmaceutical tablet was detected using a Terapulse 4000 (TeraView Ltd., Cambridge, UK) with generation and detection routines similar to that described previously [22, 23]. It is worth mentioning that, with the Terapulse 4000, the emitted terahertz beam is not tightly focused on the sample. The THz beam therefore does not rapidly diverge at the vicinity of the focal plane and can be assumed to be a propagating plane wave. In other words, the Rayleigh range of the focused beam is significantly long compared with samples’ thicknesses. This should ensure a near constant beam geometry through the tablets and hence accuracy of the measured optical constants. On the contrary, a tightly focused beam will rapidly diverge (short Rayleigh range compared with the sample thickness) and the plane wave assumption will add significant errors to the extracted optical constants. The effect of beam focusing, Gouy phase shift and sample thickness on the extracted optical constants, has been reported [50, 51] and is discussed in Section 6.

Due to the significant absorption of the terahertz radiation by water vapour [52], the sample compartment of the THz-TDS was continuously purged with nitrogen gas throughout the measuring process. The Terapulse 4000 comes with two waveform scanning methods: the slow, but high-resolution, scanning method (HiResScannerSeries) and the fast scan with low resolution (SpectralSeries). For example, with the slow scan option, it takes about a minute to acquire and average 20 time-domain waveforms whereas for the fast scan method, it takes just about a second to acquire similar waveform averages. In this tutorial, the fast scan option was used due to our current target of developing an in-line/at-line terahertz porosity method for pharmaceutical tablets. As a typical routine, a reference measurement, i.e. conducting the measurement with an empty (nitrogen gas) compartment, was acquired before each sample measurement. Figure 1 illustrates the measurement principle of measuring the time delay between a reference pulse (time of flight given as tr) and sample pulse (time of flight given as ts).

3 Data Processing and Analysis

The time- and frequency-domain data processing routines are typically performed for comparison purposes and also based on the terahertz absorption behaviour of the concerned material. For example, the frequency-domain approach is the best option when dealing with materials that exhibit distinct absorption features within the frequency range of 0.1–3.0 THz as it allows for the selection of the effective refractive index values at a portion of the spectra with little or no additional dispersion effects. However, the extraction of the frequency-domain effective refractive index demands extra mathematical steps such as the use of the fast Fourier transform, phase extraction and correction, the Beer Lamberts law and the Fresnel coefficients. On the other hand, the time-domain method is a straightforward approach to quickly calculate the effective refractive index based on the optical path length difference between the measured reference and sample signals. It is worth mentioning that the time-domain method is limited in terms of yielding an accurate prediction of the effective refractive index in cases where the terahertz pulse suffers significant broadening as a result of dispersion or absorption.

3.1 Time-Domain Signal Processing

As already mentioned, the time-domain (TD) method is a fast and a straightforward way of measuring the effective refractive index of a tablet from the terahertz pulse delay without the need of expertise in signal processing. The pulse delay is calculated from the measured time-of-flight (TOF) difference between the sample (ts) and reference (tr) pulses (see Fig. 1a).

A very simple case is illustrated in Fig. 2 where a terahertz pulse travelling from air, with refractive index nair, is incident on a homogeneous tablet with effective refractive index neff. The use of neff in this context is due to the fact that a tablet is an effective medium, i.e. composed of various materials, i.e. API(s) and excipients, with different optical constants and pores. Its bulk properties are hence governed by effective medium models.

Fig. 2
figure 2

An illustration of the concept of optical path length (OPL) for measuring the effective refractive index of tablets from the TD approach

The optical path length (OPL) travelled by the terahertz pulse during the reference (OPLr) and sample (OPLs) measurements can be expressed mathematically as,

$$ {\mathrm{OPL}}_{\mathrm{r}}={n}_{\mathrm{air}}H=c{t}_{\mathrm{r}}\kern0.5em \mathrm{and}\kern0.5em {\mathrm{OPL}}_{\mathrm{s}}={n}_{\mathrm{eff}}H=c{t}_s, $$
(1)

where c is the speed of light in vacuum and H is the thickness of the tablet.

The TD effective refractive index (neff.TD) of the tablet is obtained by subtracting the OPL of the reference from that of the sample (see Eq. 2).

$$ {n}_{\mathrm{eff}.\mathrm{TD}}=\frac{c\Delta t}{H}+1, $$
(2)

where ∆t = ts − tr is the pulse delay and nair = 1. It is worth noting that the above OPL method works perfectly for homogenous tablets with no/little variations in the neff values across the terahertz frequency range. Any significant variation in the neff will broaden the transmitted terahertz pulse and hence limit the accuracy of the ∆t measurement and in turn affect the accuracy of neff.TD.

3.2 Frequency-Domain Signal Processing

As a normal routine for the frequency-domain (FD) method, the acquired terahertz electric fields of both the sample and the reference measurements in time-domain, E(t), are converted to complex FD electric field, \( \overset{\sim }{E}(v), \)via a fast Fourier transform (FFT). The sample spectrum is then normalised by the reference spectrum to obtain a complex-valued transmission function, \( \overset{\sim }{T}(v), \)that contains both the amplitude and the phase information of the FD electric field.

$$ \overset{\sim }{T}(v)=\frac{{\overset{\sim }{E}}_{\mathrm{s}}(v)}{{\overset{\sim }{E}}_{\mathrm{r}}(v)}=T(v){e}^{i\theta (v)}, $$
(3)

where T(v) is the amplitude and θ(v) is the phase of the complex transmittance. Herein, the terahertz beam is assumed to be a plane wave, as already discussed in Section 2.1, with a normal incidence on the tablet. The frequency-dependent effective refractive index of the tablet is then accurately extracted from the phase information by, firstly, unwrapping and correcting the phase and, secondly, determining the phase difference between the reference and the sample signals similar to the routine extensively discussed by Jepsen [53]. Further detailed mathematical description of the various steps involved in the FD method has been reported in the literature [47, 54,55,56,57]. Once the phase difference (θ) has been accurately determined, the FD effective refractive index (neff.FD) is estimated by

$$ {n}_{\mathrm{eff}.\mathrm{FD}}(v)=\frac{c\theta}{2\pi vH}+1, $$
(4)

where v is the frequency in THz, c is the speed of light in vacuum and H is the thickness of the tablet. It is worth noting that Eq. (4) is only valid for a directly transmitted terahertz signal without multiple reflections (etalon effects) by the sample. In order to eliminate the typical ripple effect in the extracted refractive index spectra due to multiple reflections, the time-domain waveform was initially truncated closely before the back reflected signal from the sample. Zero padding and a suitable apodization function were used to reduce the effect of spectral leakage introduced by the truncated time-domain signal algorithm when applying the fast Fourier transform (FFT). Additionally, in order to decrease errors in the extracted phase, the phase is unwrapped starting from the frequency v = 0.8 THz as this frequency exhibits a high signal-to-noise ratio of the used instrument. The correction of the unwrapped phase is to ensure that θ = 0 at v = 0 and this was done by determining the phase offset based on a linear regression of the data within the frequency range of 0.2–0.4 THz.

The FD analysis, despite being relatively cumbersome compared with the TD method, has an added merit of revealing specific phonon vibrations (spectral features) of crystalline constituents of tablets. Due to the crystalline nature of most active pharmaceutical ingredients (APIs), THz-TDS has been used for the identification of specific drugs in pharmaceutical tablets [58, 59]. The presence of the spectral features can cause significant dispersion or variations in the effective refractive at the respective resonant frequencies. Dispersion will cause each wavelength component of the terahertz pulse to travel at a different group velocity and in turn broadens the transmitted terahertz pulse. A broadened pulse, as already mentioned, will limit the use of the TD method to accurately measure the effective refractive index and hence the terahertz porosity of the tablets. In such cases the application of the FD method becomes very useful since it allows for the selection of the effective refractive index at a spectral region where no significant dispersion effect is observed. By measuring the effective refractive index over the same frequency range for all tablets within a given batch, accuracy and consistency are assured in the extracted tablets porosity.

In this tutorial, the selected FD effective refractive index values used for the calculation of the terahertz porosity of the batches were obtained by averaging the effective refractive index values within the frequency range of 0.4–0.8 THz. The selected frequency range, as shown by the rectangular shaded portion in Fig. 3, was observed to be a dispersion free region for all the batches. Additionally, the selected frequency range lies within the range of 0.3–0.9 THz, where the current instrument has its maximum signal-to-noise ratio and this further serves as a reason for deciding on the frequency(ies) to be selected for the analysis. However, in the case of non-polar polymers that exhibit a sloping or dispersive refractive index across the measured frequency range, the selection of the refractive index at a single terahertz frequency will be more appropriate. Depending on the instrument characteristics as well as the dispersion properties of the materials involved, different frequency ranges, or indeed a single frequency, could be chosen.

Fig. 3
figure 3

Frequency-domain effective refractive index showing the selected portion for the flat-faced (a) and biconvex (b) tablets used as a case study (see Section 4 for the detailed description of the tablets)

Finally, potential scattering from individual particles, granules or clusters within the powder matrix will further affect the choice of the most suitable frequency (range) for subsequent porosity analysis. For example, in this work the particle size distribution for the powders used range from a few tens of micrometres to a few hundreds of micrometres in diameter: for example the dominant material has an average particle size in the range of about 160–340 μm. Hence, significant scattering is expected at frequencies above 0.9 THz, which can be clearly seen in the refractive index spectra presented in Fig. 3. Nevertheless, the relatively narrow frequency range due to scattering and absorption should not limit the applicability of the method since the refractive index can be selected at any frequency(ies) based on the above selection criteria.

4 Tablet Compaction

In this tutorial, five batches, each, of flat-faced and biconvex tablets were directly compressed using the same formulation (see Table 1) with commonly used excipients (microcrystalline cellulose, lactose, croscarmellose sodium, magnesium stearate, and ibuprofen as the API. Microcrystalline cellulose and lactose served as both diluents and binders to achieve tablets with reasonable mass and hardness properties. Magnesium stearate was used as a lubricant to ease the in-die ejection of the tablets after compaction and the croscarmellose sodium acts as a disintegrant. The proportions of the various powders, as given in Table 1, were weighed and properly mixed to ensure homogeneity using a Turbula® T2F Mixer (Willy A. Bachofen AG, Switzerland). The blending process lasted for 11 min with a speed of 32 rpm. All the material components except magnesium stearate were added to a plastic bottle and blended for 10 min followed by the addition of the magnesium stearate and further blending for 1 min.

Table 1 Material composition of the formulation used in the direct compaction of all the batches of tablets used as a case study in this tutorial

After the blending, five batches of both the flat-faced and biconvex tablets with different porosities and thicknesses, within the respective range of 6–25% and 3.7–5.5 mm, were directly compressed using a compaction simulator (HB50, Huxley Bertram Engineering Ltd., UK). For a given batch, 15 tablets were compacted with each tablet stored in a labelled and sealed plastic bag. By using the compaction simulator, we were able to mimic the manufacturing characteristics of tablets produced in a typical industrial setting at full production scale and speed. In this study, the production-scale tablet press, Fette 2090 compression profile, with a compression speed of 60 rpm, i.e. ≈ 0.35 s to compress and eject a tablet, was used for compacting all the batches. The targeted porosity for each batch was achieved by keeping the weight of all tablets at about 400 mg and adjusting their thickness.

5 Porosity Measurement

Porosity, a potential critical quality attribute (CQA) of tablets, is one of the most important contributors to tablet disintegration and dissolution characteristics [46]. Porosity governs the mass transport processes and mechanical changes in tablets during disintegration and hence directly affects the dissolution time of tablets. Since porosity is a volumetric property, the use of the THz-TDS method, which is conducted in the transmission configuration, has been demonstrated to accurately measure porosity of homogenous tablets compared to conventional methods like mercury porosimetry [46]. This is due to the fact that the terahertz method is able to probe both connected and isolated pores whereas conventional methods like mercury porosimetry only capture connected pores. Adding to the above merits, THz-TDS is a reliable method for measuring the bulk properties of tablets compared with other spectroscopic counterparts, e.g. Raman and near infrared (NIR) spectrometers, that typically probe only surface properties that do not necessarily represent the bulk tablet property. Finally, we want to reiterate that the terahertz method is robust, non-destructive, contactless and sufficiently fast (within a second) to meet the speed requirements for both at-line and in-line applications.

This tutorial explains the chronological steps involved in the use of the THz-TDS method for the accurate measurement of tablet porosity. We shall commence by discussing the steps involved in measuring a tablet porosity from its weight and dimensions, which is dubbed as its nominal porosity, and proceed with how the nominal porosity in conjunction with the measured effective refractive index is used for the extraction of the terahertz porosity based on the Bruggeman EMA. It should be made clear at this point that the use of the terahertz porosity method will always demand the preparation and measurement of a materials characterisation set composed of tablets that were compacted over a range of porosities. Results obtained from this set will then be used as a yardstick for tracking the porosity of all batches compressed with the same formulation.

5.1 Nominal Porosity

The bulk density (ρtablet) of the tablet was calculated from its measured weight, W, and the volume, V:

$$ {\rho}_{\mathrm{tablet}}=\frac{W}{V}. $$
(5)

For the case of a flat-faced tablet, \( V=\pi {\left(\raisebox{1ex}{$d$}\!\left/ \!\raisebox{-1ex}{$2$}\right.\right)}^2H \) with the height / thickness, H, and diameter, d (see Fig. 4a). For a biconvex tablet with dimensions as illustrated in Fig. 4b, the volume was obtained by

$$ V=2\uppi {h}^2\left({R}_{\mathrm{p}}-\frac{h}{3}\right)+\uppi {\left(\frac{d}{2}\right)}^2L $$
(6)

where Rp is the punch radius (the radius of curvature of the tablet). L is the length of the cylindrical portion sandwiched between the two identical spherical caps, and d is the diameter of the tablet. H is the height of the biconvex tablet measured from the centre whereas h is the height of the spherical cap.

Fig. 4
figure 4

The dimensions of typical (a) flat-faced and (b) biconvex pharmaceutical tablet

The nominal porosity (fnominal) was then estimated from the bulk density and the true density (ρtrue) of the powder formulation as follows

$$ {f}_{\mathrm{nominal}}=1-\frac{\rho_{\mathrm{tablet}}}{\rho_{\mathrm{true}}}. $$
(7)

The nominal porosity of the batches was measured several days after the compaction to allow for possible after-compaction mechanical relaxation of the tablets due to elastic recovery of the tablet matrix. In this tutorial, five batches each of flat-faced and biconvex tablets were used. The height and diameter of each tablet within a batch were measured using a micrometre (Sealey Digital External Micrometer 0-25mm; Rapid Electronics Limited, Colchester, UK) and weight measured using an analytical balance (Fisher Scientific, Illkirch-Graffenstaden, France). The spherical cap h which is given by the radius of curvature of the concave punches was measured with a digital calliper. The true density, ρtrue, of the powder mixer was measured by using a helium pycnometer (Multipycnometer MVP-1; Quantachrome Corporation, New York, NY). The averaged measured tablet parameters of each batch (15 tablets) are summarised in Tables 2 and 3.

Table 2 The measured averaged parameters of the five batches of flat-faced tablets. Each batch composed of 15 tablets. The tablet density, ρtablet, was calculated from the weight and dimensions using Eq. 5. The measured true density was, ρtrue = 1.439 g cm−3, and the nominal porosity was estimated using Eq. 7
Table 3 The measured averaged parameters of the five batches of biconvex tablets. Each batch contained 15 tablets. From Eq. 6 the tablets’ volume was calculated with the parameters h = 1.01 mm and L = H − 2h. The tablet density, ρtablet, was then determined from the weight and volume using Eq. 5. With the measured true density, ρtrue = 1.439 g cm−3, the nominal porosity was estimated using Eq. 7

5.2 Terahertz Porosity Measurement

Three approaches based on refractive index-porosity relationships have mostly been exploited for the extraction of the porosity of tablets from terahertz measurements. For all the approaches, a pharmaceutical tablet is assumed to be a two-phase effective medium that composes of air and a solid medium. In the simplest case the solid medium could be a particular compound for tablets made of one powder only or, more commonly, it would constitute a mixture of different solid compounds of excipient(s) and API(s) for typical commercial tablets.

The first approach is based on an established simple linear model between the effective refractive index (neff) and the porosity of tablets, namely the zero-porosity approximation (ZPA) given as

$$ {n}_{\mathrm{eff}}={n}_{\mathrm{solid}}+\left(1-{n}_{\mathrm{solid}}\right)f, $$
(8)

where neff could be either the values of neff.TD or neff.FD depending on which data analysis approach, FD or TD, is used. f is the terahertz-based porosity value.

The second and third approaches are based on the use of the Bruggeman effective medium approximation (Br-EMA) [60] to relate the effective refractive index to the porosity, f, of the tablets. The porosity range of typical pharmaceutical tablets is mostly around 10–15%, which makes the Br-EMA the best model to be adopted as compared with the Maxwell Garnett’s EMA that is valid at low very porosities (less than 2%). The general form of the Br-EMA follows naturally from the Maxwell Garnett’s EMA [61] as

$$ {\sum}_{\mathrm{j}=1}^J{f}_{\mathrm{j}}\frac{\varepsilon_{\mathrm{j}}-{\varepsilon}_{\mathrm{eff}}}{\varepsilon_{\mathrm{eff}}+g\left({\varepsilon}_{\mathrm{j}}-{\varepsilon}_{\mathrm{eff}}\right)}=0 $$
(9)

where j is the number of inclusions (j =1,2,3…J) and with \( {\sum}_{j=1}^{\mathrm{J}}{f}_j=1 \). g is a depolarisation or shape factor, εj is the permittivity of the various inclusions and εeff is the permittivity of the effective medium. The second approach, henceforth referred to as the traditional Bruggeman effective medium approximation (TB-EMA), is constructed based on an assumption of spherical inclusions where g = 1/3. From Eq. 9 and by considering a tablet as a two-phase medium (air and solid), the TB-EMA takes the form

$$ \frac{n_{\mathrm{solid}}^2-{n}_{\mathrm{eff}}^2}{n_{\mathrm{eff}}^2+2\left({n}_{\mathrm{solid}}^2-{n}_{\mathrm{eff}}^2\right)}\left(1-f\right)-\frac{n_{\mathrm{air}}^2-{\mathrm{n}}_{\mathrm{eff}}^2}{n_{\mathrm{eff}}^2+2\left({n}_{\mathrm{air}}^2-{n}_{\mathrm{eff}}^2\right)}f=0, $$
(10)

where we have used a straightforward conversion between permittivity (ε) and the refractive index (n) as ε = n2.

A typical limitation of the TB-EMA approach arises when the actual shape of the inclusions significantly deviates from a sphere. This phenomenon leads to the introduction of a symmetric error, which is observed when the extracted terahertz porosity is plotted against the nominal porosity.

Finally, the third terahertz porosity measurement approach, called the anisotropic Bruggeman effective medium approximation (AB-EMA), is also based on similar analogy as the TB-EMA but considers non-spherical inclusions given as follows [44].

$$ \frac{n_{\mathrm{solid}}^2-{n}_{\mathrm{eff}}^2}{n_{\mathrm{eff}}^2+g\left({n}_{\mathrm{solid}}^2-{n}_{\mathrm{eff}}^2\right)}\left(1-f\right)+\frac{n_{\mathrm{air}}^2-{n}_{\mathrm{eff}}^2}{n_{\mathrm{eff}}^2+g\left({n}_{\mathrm{air}}^2-{n}_{\mathrm{eff}}^2\right)}f=0. $$
(11)

The AB-EMA allows the calculation and use of the g factor and therefore corrects the existing symmetric error (a major limitation of the TB-EMA), which enhances the accuracy of the measured terahertz porosity. Moreover, the knowledge of the g factor permits the prediction of the pore shape, which is an added merit of the AB-EMA compared with both the ZPA and TB-EMA methods.

As already mentioned, this terahertz porosity measurement method always demands the use of a flat-faced tablets set with known nominal porosities and effective refractive index values determined in TD or in FD. These known parameters in conjunction with the ZPA (Eq. 8), TB-EMA (Eq. 10), or AB-EMA (Eq. 11) are used to accurately calculate the refractive index of the solid matrix. In order words, the initial flat-faced tablets set is used to obtain the intrinsic (solid) refractive index of the solid matrix (powder blend) that is used for further analyses. Henceforth, the porosity of any batch of any shape tablets compressed from a powder blend with known intrinsic refractive index of the solid matrix (nsolid) can be measured non-invasively by solving for f (henceforth referred to as the terahertz porosity) using either the ZPA (Eq. 8), TB-EMA (Eq. 10), or AB-EMA (Eq. 11) as given in Eq. 12 below.

$$ {f}_{\mathrm{ZPA}}=\frac{n_{\mathrm{eff}}-{n}_{\mathrm{solid}}}{1-{n}_{\mathrm{solid}}},{f}_{\mathrm{TB}-\mathrm{EMA}}=\frac{1}{1-\left(\frac{1-{n}_{\mathrm{eff}}^2}{1+2{n}_{\mathrm{eff}}^2}\right)\left(\frac{n_{\mathrm{solid}}^2+2{n}_{\mathrm{eff}}^2}{n_{\mathrm{solid}}^2-{n}_{\mathrm{eff}}^2}\right)},{f}_{\mathrm{AB}-\mathrm{EMA}}=\frac{1}{1-\left(\frac{1-{n}_{\mathrm{eff}}^2}{1+g{n}_{\mathrm{eff}}^2}\right)\left(\frac{n_{\mathrm{solid}}^2+g{n}_{\mathrm{eff}}^2}{n_{\mathrm{solid}}^2-{n}_{\mathrm{eff}}^2}\right)} $$
(12)

6 Case Study and Discussions

This tutorial has utilised prepared batches of flat-faced and biconvex tablets as a case study to systematically demonstrate the application of the terahertz porosity measurement technique.

6.1 Terahertz Effective Refractive Index by TD and FD Methods

The conduction of the reference and sample measurements marks the onset of the terahertz method, which leads to the measurements of the effective refractive index of the tablets either by the TD or the FD method. As shown in Fig. 5a–d for the flat-faced and biconvex tablets, respectively, the measured neff based on the TD (Fig. 5a, c) and FD (Fig. 5b, d) methods are compared. The TD effective refractive index, neff.TD, was extracted from the measured terahertz pulse delay using Eq. 2 whereas the neff.FD was obtained from the phase difference using Eq. 4. The values of neff.FD, shown in Fig. 5, were obtained by selecting and averaging the refractive indices from a dispersion-free portion of the refractive index spectra as already illustrated in Fig. 3. Herein, the averaged neff.FD values within the frequency range of 0.4–0.8 THz were used for all the batches. Both the TD and FD approach worked well for the samples given their closely matched values. The slight differences in values between the TD and FD approaches can be attributed to possible dispersion effects that may have caused a broadening effect on the terahertz pulse as it traverses the sample (Table 4). The broadening effect will decrease the accuracy of the pulse delay extraction and hence increase the error in the measured neff.TD. However, with the FD approach the dispersion effect is eliminated through the neff.FD selection process outlined above. Also, the FD approach ensures consistency and allows comparison of the measured neff.FD among the various tablets given the use of a constant frequency range for selection of neff.FD for all the tablets. Based on the proven confidence in the accuracy of the FD method, the neff.FD was used in the rest of the analyses in this tutorial.

Fig. 5
figure 5

A comparison of the extracted TD and FD effective refractive index for the flat-faced tablet (a, b) and biconvex tablets (c, d)

Table 4 Comparing and contrasting the performance of the TD and the FD signal processing techniques for the accurate measurement of the effective refractive index of a tablet

6.2 Terahertz Porosity Measurement

From the known effective refractive index coupled with either the ZPA, the TB-EMA or the AB-EMA method (see Eq. 12), the terahertz porosity for the sets of tablets was measured. The intrinsic refractive index, nsolid, was calculated using the neff.FD and the nominal porosity, coupled with the respective Eqs. 8, 10 and 11 for the ZPA, the TB-EMA and the AB-EMA methods. The three methods are in an excellent agreement for the flat-faced tablets as reflected in the closely matched values of the estimated nsolid (see Table 5). Hence, the assumption of spherical inclusions was valid for the flat-faced tablets. However, the assumption of the spherical inclusions did not hold for the biconvex tablets as observed in the deviation of the nsolid obtained by the TB-EMA method compared with that of the ZPA and the AB-EMA methods. Although both the flat-faced and biconvex tablets were compacted from a similar formulation, it is surprising to observe the significant difference in their nsolid values. The high values of nsolid for the biconvex tablets can be attributed to the non-sphericity, as given by the g factor, and orientation of the solid particles within the tablet. The values of g used in the current analyses for the flat-faced and biconvex tablets were 0.36 and 0.51, respectively. It is worth mentioning that the authors are currently working on a tutorial that seeks to provide an in-depth discussion on pore structure analyses of pharmaceutical tablets.

Table 5 Comparing the performance of the three terahertz porosity measurement methods for both the flat-faced and biconvex tablets (Fig. 6)

Once the intrinsic refractive index, nsolid, of the tablets is known, the terahertz porosity can be estimated using the three methods as given by Eq. 12. In the case of the flat-faced tablets, Fig. 6a shows how similar the results are derived from the three methods (ZPA, TB-EMA and AB-EMA) for the accurate estimation of the terahertz porosity. The values of the coefficient of determination, R2; the root mean square error, RMSE; and the slope given in Table 5 further show how closely the three methods perform for measuring the porosity of flat-faced tablets. However, in the case of the biconvex tablets, the AB-EMA outperforms both the ZPA and the TB-EMA methods. Based on the data shown in Fig. 6b, the ZPA appears to overestimate the terahertz porosity whereas, unsurprisingly, an existing symmetric error was detected in the porosity extracted by the TB-EMA method. Despite the observed perfect linear relation between fTHz and fnominal for the three methods (see the R2 values for the biconvex tablets in Table 5), the AB-EMA outperformed both the ZPA and the TB-EMA in terms of accuracy (AB-EMA gave the least RMSE and a slope ≈ 1).

Fig. 6
figure 6

A comparison of the performances of the three terahertz porosity measurement approaches (ZPA, TB-EMA and AB-EMA) on the flat-faced tablets (a) and the biconvex tablets (b)

From the above observation, the choice of a particular method depends on the type of materials and their relative composition as well as the geometry of the tablet. By bearing in mind the close performance of the three methods in case of the flat-faced tablets, one can conveniently adopt any of the three methods without worrying so much about errors in the extracted parameters. From a research point of view, flat-faced tablets are more convenient to study due to the ability to precisely measure their dimensions (thickness and diameter) and the nominal porosity that serve as the basic input parameters in the terahertz porosity method. Additionally, it is quite intuitive to assume that flat-faced compression tooling will naturally allow for a more even distribution of pressure across the surface of the tablet during compaction; hence, the anisotropic phenomena that can take place during compaction of tablets may be less pronounced since the pores are more likely to assume spherical shape.

In contrast, for biconvex tablets, the situation can become more complicated due to possible uneven pressure distribution as well as the difficulty to precisely measure the compaction parameters during compaction. Furthermore, it is more difficult to ensure that the terahertz beam propagates exactly through the centre of the tablet during the transmission measurements as well as maintaining consistency to accurately measure the thickness of the tablets at exactly the same spot. These are additional challenges that need to be considered when dealing with biconvex tablets. Studies have shown that the presence of uneven pressure distribution during compaction yields biconvex tablets with high density distribution along the centre [62], which may partly explain the higher neff values obtained for the biconvex tablets compared with the flat-faced tablets (Fig. 5).

Differences observed in the refractive index values can also be attributed to thickness variations (≈ 1 mm) between the flat-faced and the biconvex tablets. The relatively thick biconvex tablets, during the transmission measurement, may cause a significant shift in the focal plane of the terahertz beam compared with its reference measurement. The shift in the focal plane of the transmitted terahertz beam means that the reference and sample signal will be detected at a different axial position with different Gouy phases at the detector level. The induced relatively larger Gouy phase shift for the biconvex tablets will introduce a significant uncertainty in the extracted refractive index [50, 51]. Nonetheless, by considering the relatively long Rayleigh range of the focused terahertz beam used in this study, a shift in the Gouy phase due to a thickness difference should have negligible effect on the extracted refractive index of the tablets. The estimated Rayleigh range at 1 THz of the beam with a waist radius of 1 mm is about 10.5 mm, which is greater than the maximum thickness of the analysed tablets, i.e. 5.53 mm.

Moreover, curvature and possible lensing effect of the biconvex tablets can cause further refraction of the THz beam and hence influence the level of uncertainty in the extracted refractive index.

An extensive study aimed to critically ascertain the effect of density distribution, Gouy phase shift, geometry and lensing effects of pharmaceutical tablets on the measured optical constants and hence the porosity using the proposed THz method is currently ongoing. We recently conducted experiments by mapping over biconvex tablets in transmission using a moving sample stage. The preliminary results (unpublished) have shown the possibility of resolving density differences/spatially dependent porosity values within the tablets using the terahertz method.

It is important to emphasise that the thickness and the nominal porosity measurements are absolutely critical for the accuracy of the terahertz porosity method. Thickness and nominal porosity serve as the basic inputs variables for all analyses involved in the terahertz porosity method. For example, an error introduced in the measured thickness and porosity will propagate, and significantly affect, the measured effective refractive index, the solid refractive index and hence the predicted terahertz porosity as well as the pore structure. It is therefore strongly recommended that care and consistency must be maintained especially during the thickness measurement as it affects every aspect involved in the data analysis process.

7 Conclusions

This tutorial has outlined the steps required in the use of THz-TDS to quickly and non-destructively measure the porosity of the pharmaceutical tablets. As a case study, two sets of tablets, i.e. flat-faced and biconvex tablets, were prepared and measured. Five batches of each set composed of 10% ibuprofen were compacted with varying porosity within the range of 7–23%. A comparison made from the use of the TD and FD signal processing techniques has clearly shown that the FD approach comes with additional merits that typically outperforms the TD approach. For example, the FD approach is insensitive to dispersion-based errors and allows consistency in the extraction of the effective refractive index for all the samples.

The results of a similar comparison of the three terahertz porosity measurement methods (ZPA, TB-EMA and AB-EMA) have resulted in the recommendation to use the AB-EMA method due to its ability to account for non-spherical inclusions and is therefore more robust for tablets of a wide range of size and geometry. The performance of the AB-EMA method was found to be independent of the pore shape, material, complexity and geometry of the tablets. The ZPA and the TB-EMA methods were found to be strongly influenced by the pore shape, formulation material, tablet complexity and geometry and hence should only be chosen and used in well-defined situations.