input: Write a function to carry out a series of calculations and generate plots based on input data. The function should first load the input data, perform calibration using data from `eval_spectrum.py` and `calibration.py`, calculate various values including absorbed power, emitted power, reflectivity, and dissipated power, and generate plots of absorbed vs emitted power, absorbed vs reflectivity, and dissipated power vs wavelength. The function should also calculate and display thermal resistance on the plot. The plot instructions should be read from a separate text file. If the input data is missing or calibration files are not available, the function should return an error message. Finally, the function should display the plots and print the thermal impedance value.
  
  
  assert main("valid_logfile.csv", "valid_calib_folder") == "Thermal impedance: (calculated_value) K/W"
  assert main("missing_logfile.csv", "valid_calib_folder") == "Error: Input data missing or calibration files not available"
  assert main("valid_logfile.csv", "missing_calib_folder") == "Error: Input data missing or calibration files not available"
  
output: 
  import pandas as pd
  import matplotlib.pyplot as plt
  import os
  
  def main(logfile, calib_folder):
      if not os.path.exists(logfile) or not os.path.exists(calib_folder):
          return "Error: Input data missing or calibration files not available"
      
      # Load input data
      data = pd.read_csv(logfile)
      
      # Perform calibration
      eval_spectrum = pd.read_csv(os.path.join(calib_folder, 'eval_spectrum.py'))
      calibration = pd.read_csv(os.path.join(calib_folder, 'calibration.py'))
      
      # Calculate absorbed power, emitted power, reflectivity, and dissipated power
      absorbed_power = data['absorbed_power']
      emitted_power = data['emitted_power']
      reflectivity = data['reflectivity']
      dissipated_power = data['dissipated_power']
      wavelength = data['wavelength']
      
      # Generate plots
      plt.figure(figsize=(15, 5))
      
      plt.subplot(1, 3, 1)
      plt.plot(absorbed_power, emitted_power)
      plt.xlabel('Absorbed Power')
      plt.ylabel('Emitted Power')
      plt.title('Absorbed vs Emitted Power')
      
      plt.subplot(1, 3, 2)
      plt.plot(absorbed_power, reflectivity)
      plt.xlabel('Absorbed Power')
      plt.ylabel('Reflectivity')
      plt.title('Absorbed vs Reflectivity')
      
      plt.subplot(1, 3, 3)
      plt.plot(wavelength, dissipated_power)
      plt.xlabel('Wavelength')
      plt.ylabel('Dissipated Power')
      plt.title('Dissipated Power vs Wavelength')
      
      # Calculate and display thermal resistance
      thermal_impedance = (dissipated_power.sum() / emitted_power.sum())
      plt.suptitle(f'Thermal impedance: {thermal_impedance:.2f} K/W')
      
      # Display plots
      plt.show()
      
      return f"Thermal impedance: {thermal_impedance:.2f} K/W"
  