@@ -87,6 +87,22 @@ def retrieve_list_of_tif(folder: str) -> list:
8787    return  list_tif 
8888
8989
90+ def  create_x_axis_file (lambda_array : np .ndarray  =  None , 
91+                        energy_array : np .ndarray  =  None , 
92+                        output_folder : str  =  "./" ) ->  str :
93+     """create x axis file with lambda, energy and tof arrays""" 
94+     x_axis_data  =  {
95+         "file_index" : np .arange (len (lambda_array )),
96+         "lambda (Angstroms)" : lambda_array ,
97+         "energy (eV)" : energy_array ,
98+     }
99+     x_axis_file_name  =  os .path .join (output_folder , "x_axis.txt" )
100+     pd_dataframe  =  pd .DataFrame (x_axis_data )
101+     pd_dataframe .to_csv (x_axis_file_name , index = False , sep = "," )
102+ 
103+     logging .info (f"X axis file created: { x_axis_file_name }  )
104+ 
105+ 
90106def  normalization_with_list_of_runs (sample_run_numbers : list  =  None , 
91107                                    ob_run_numbers : list  =  None , 
92108                                    output_folder : str  = "./" , 
@@ -137,13 +153,15 @@ def normalization_with_list_of_runs(sample_run_numbers: list = None,
137153    export_corrected_integrated_sample_data  =  export_mode .get ("sample_integrated" , False )
138154    export_corrected_integrated_ob_data  =  export_mode .get ("ob_integrated" , False )
139155    export_corrected_integrated_normalized_data  =  export_mode .get ("normalized_integrated" , False )
156+     export_x_axis  =  export_mode .get ("x_axis" , True )
140157
141158    logging .info (f"{ export_corrected_stack_of_sample_data  =  }  )
142159    logging .info (f"{ export_corrected_stack_of_ob_data  =  }  )
143160    logging .info (f"{ export_corrected_stack_of_normalized_data  =  }  )
144161    logging .info (f"{ export_corrected_integrated_sample_data  =  }  )
145162    logging .info (f"{ export_corrected_integrated_ob_data  =  }  )
146163    logging .info (f"{ export_corrected_integrated_normalized_data  =  }  )
164+     logging .info (f"{ export_x_axis  =  }  )
147165
148166    sample_master_dict , sample_status_metadata  =  create_master_dict (list_run_numbers = sample_run_numbers , 
149167                                                             data_type = DataType .sample ,
@@ -387,6 +405,12 @@ def normalization_with_list_of_runs(sample_run_numbers: list = None,
387405                spectra_file  =  sample_master_dict [_sample_run_number ][MasterDictKeys .spectra_file_name ]
388406                shutil .copy (spectra_file , full_output_folder )
389407
408+                 # create x-axis file 
409+                 create_x_axis_file (lambda_array = lambda_array ,
410+                                    energy_array = energy_array ,
411+                                    output_folder = output_stack_folder ,
412+                                    )
413+ 
390414    logging .info (f"Normalization and export is done!" )
391415    if  verbose :
392416        display (HTML (f"Normalization and export is done!" ))
0 commit comments