input: Write a function to execute a script that performs a series of calculations and plots based on input data. Before running the main function, ensure that eval_spectrum.py and calibration.py are executed 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, generates plots based on instructions provided in a separate text file, and displays thermal resistance on the plot. The generated plots show absorbed power vs emitted power, absorbed power vs reflectivity, and dissipated power vs wavelength. To run the code, execute the main function.
  assert main("example_logfile.csv", "example_calib_folder") == None
  assert main("empty_logfile.csv", "empty_calib_folder") == None
output: def main(logfile, calib_folder):
      import eval_spectrum
      import calibration
      import pandas as pd
      import matplotlib.pyplot as plt
      
      # Execute eval_spectrum.py and calibration.py
      eval_spectrum.run()
      calibration.run(calib_folder)
      
      # Load input data
      data = pd.read_csv(logfile)
      
      # Perform calibration
      calibrated_data = calibration.calibrate(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']
      
      # Generate plots
      plt.figure(1)
      plt.plot(absorbed_power, emitted_power)
      plt.xlabel('Absorbed Power')
      plt.ylabel('Emitted Power')
      plt.title('Absorbed Power vs Emitted Power')
      
      plt.figure(2)
      plt.plot(absorbed_power, reflectivity)
      plt.xlabel('Absorbed Power')
      plt.ylabel('Reflectivity')
      plt.title('Absorbed Power vs Reflectivity')
      
      plt.figure(3)
      plt.plot(dissipated_power, wavelength)
      plt.xlabel('Dissipated Power')
      plt.ylabel('Wavelength')
      plt.title('Dissipated Power vs Wavelength')
      
      # Display thermal resistance on the plot
      thermal_resistance = calibration.calculate_thermal_resistance(calibrated_data)
      plt.text(0.5, 0.5, f'Thermal Resistance: {thermal_resistance}', transform=plt.gca().transAxes)
      
      plt.show()