# Jonathan Thomson's web journal Once you’ve removed the distortion caused by the spectrometer’s system function from a spectrogram you can radiometrically calibrate it if you’ve added a TSL230 irradiance sensor to your spectrometer. A spectrogram may be calibrated by either indirect or direct calibration. If the incandescent lamp input spectrum used to determine the system function is radiometrically calibrated, then dividing the system function out of a spectrogram should result in it also being radiometrically calibrated. This is known as indirect calibration because a direct irradiance measurement of the light source of interest wasn’t used to calibrate its spectrogram. Direct calibration uses a measurement taken from an irradiance sensor of the light source of interest to calibrate its spectrogram and relies on the act of dividing out the system function to remove distortion but not to perform calibration. Unfortunately indirect and direct calibrations don’t always agree with each other because the irradiance sensor and camera are physically separated and don’t always see a light source in the same way. For example, a light source could look like a point source to the camera, but like an area source to the irradiance sensor. Also, assuming a nonisotropic source, the rays that strike the irradiance sensor might not originate from a part of the source with same radiation pattern as the rays that strike the camera. For this reason, it’s best to always reference every spectrogram to what the irradiance sensor sees. Therefore you should take an irradiance measurement of every light source of interest and use those measurements to directly calibrated their spectrograms.

A mathematical model of the TSL230 family of irradiance sensors and an explanation of how they work can be found in the Irradiance Meter article in my series about the TSL230R. However you don’t really need to understand all the details because the function TSL230_fO_to_irradiance() will perform the calibration for you if you provide it with a spectrogram and an fO measurement. Here’s a code snippet that demonstrates how the function is used.

```   sensor_type = 'TSL230RD';
fO = 1.8416; % [kHz]
sensitivity = 1;
distance = 0.076200; % [m]

% so.Hr is the radiometrically calibrated system function
Z = image2spectrum(Cyan_LED_Spectrograph);
Z = filtfilt(Ftri, 1, Z); % distorted spectrogram, [count]
Ee = Z./so.Hr; % corrected spectrogram, spectral irradiance, [W/m^2/nm]
Ee_green = Ee(:,2); % the green channel only

% Ee_green is the indirectly calibrated spectral irradiance of the cyan LED, [W/m^2/nm]
% Ee2 is the directly calibrated spectral irradiance of the cyan LED, [W/m^2/nm]
Ee2 = TSL230_fO_to_irradiance(lambda, Ee_green, fO, sensitivity, sensor_type, 'power');
```

Code
The primary script system_function_calibrated will compute the radiometrically calibrated system function `so.Hr`, which can then be used to remove distortion from a spectrogram and indirectly radiometrically calibrate it. The example script example05_Hr_cyan_LED demonstrates the removal of the system function from a spectrogram and compares indirect calibration to direct calibration. 