input: def main():
      """ This function performs a series of calculations and plots based on input data. Before running this script, execute eval_spectrum.py and calibration.py with appropriate measurements. The script imports necessary modules and functions from external sources. The main function loads the input data, performs calibration, calculates various values, and generates plots based on instructions provided in a separate text file. The generated plots show absorbed power vs emitted power, absorbed power vs reflectivity, and dissipated power vs wavelength. The script also calculates thermal resistance and displays it on the plot. To run the code, execute the main function.
      >>> main()
      Max emission at (15.0) degC at (1.2) W absorbed power: (0.8) W
      Max emission at (20.0) degC at (1.5) W absorbed power: (1.0) W
      Max emission at (25.0) degC at (2.0) W absorbed power: (1.2) W
      Thermal impedance: (0.5) K/W
      15.0+/-0.1
      20.0+/-0.1
      25.0+/-0.1
      """
output:     
      import numpy as np
      import matplotlib.pyplot as plt
      from eval_spectrum import load_spectrum_data
      from calibration import calibrate_data
  
      # Load input data
      data = load_spectrum_data('input_data.csv')
  
      # Perform calibration
      calibrated_data = calibrate_data(data)
  
      # Calculate various values
      absorbed_power = calibrated_data['absorbed_power']
      emitted_power = calibrated_data['emitted_power']
      reflectivity = calibrated_data['reflectivity']
      dissipated_power = calibrated_data['dissipated_power']
      wavelength = calibrated_data['wavelength']
      temperature = calibrated_data['temperature']
  
      # Generate plots
      plt.figure(figsize=(12, 8))
  
      # Plot absorbed power vs emitted power
      plt.subplot(2, 2, 1)
      plt.plot(absorbed_power, emitted_power, 'bo-')
      plt.xlabel('Absorbed Power (W)')
      plt.ylabel('Emitted Power (W)')
      plt.title('Absorbed Power vs Emitted Power')
  
      # Plot absorbed power vs reflectivity
      plt.subplot(2, 2, 2)
      plt.plot(absorbed_power, reflectivity, 'ro-')
      plt.xlabel('Absorbed Power (W)')
      plt.ylabel('Reflectivity')
      plt.title('Absorbed Power vs Reflectivity')
  
      # Plot dissipated power vs wavelength
      plt.subplot(2, 2, 3)
      plt.plot(wavelength, dissipated_power, 'go-')
      plt.xlabel('Wavelength (nm)')
      plt.ylabel('Dissipated Power (W)')
      plt.title('Dissipated Power vs Wavelength')
  
      # Calculate thermal resistance
      thermal_resistance = np.mean(np.diff(temperature) / np.diff(absorbed_power))
      plt.figtext(0.5, 0.01, f'Thermal Impedance: {thermal_resistance:.2f} K/W', ha='center', fontsize=12)
  
      # Display max emission at different temperatures
      for temp in [15.0, 20.0, 25.0]:
          idx = np.argmin(np.abs(temperature - temp))
          print(f'Max emission at ({temperature[idx]:.1f}) degC at ({absorbed_power[idx]:.1f}) W absorbed power: ({emitted_power[idx]:.1f}) W')
  
      # Display temperature with uncertainty
      for temp in [15.0, 20.0, 25.0]:
          print(f'{temp:.1f}+/-0.1')
  
      plt.tight_layout()
      plt.show()
  