@@ -45,45 +45,44 @@ def main(args=None):
4545
4646 log .setLevel (args .loglevel )
4747
48- with log .log_to_file ("HENcolors.log" ):
49- energies = [
50- [args .energies [0 ], args .energies [1 ]],
51- [args .energies [2 ], args .energies [3 ]],
52- ]
53- if args .outfile is not None and len (files ) > 1 :
54- raise ValueError ("Specify --output only when processing " "a single file" )
55- for f in files :
56- events = load_events (f )
57- if not args .use_pi and events .energy is None :
58- raise ValueError (
59- f"Energy information not found in file { f } . "
60- "Use --use-pi if you want to use PI channels "
61- "instead."
62- )
63- h_starts , h_stops , colors , color_errs = events .get_color_evolution (
64- energy_ranges = energies , segment_size = args .bintime , use_pi = args .use_pi
48+ energies = [
49+ [args .energies [0 ], args .energies [1 ]],
50+ [args .energies [2 ], args .energies [3 ]],
51+ ]
52+ if args .outfile is not None and len (files ) > 1 :
53+ raise ValueError ("Specify --output only when processing " "a single file" )
54+ for f in files :
55+ events = load_events (f )
56+ if not args .use_pi and events .energy is None :
57+ raise ValueError (
58+ f"Energy information not found in file { f } . "
59+ "Use --use-pi if you want to use PI channels "
60+ "instead."
6561 )
62+ h_starts , h_stops , colors , color_errs = events .get_color_evolution (
63+ energy_ranges = energies , segment_size = args .bintime , use_pi = args .use_pi
64+ )
6665
67- time = (h_starts + h_stops ) / 2
66+ time = (h_starts + h_stops ) / 2
6867
69- scolor = Lightcurve (
70- time = time ,
71- counts = colors ,
72- err = color_errs ,
73- input_counts = False ,
74- err_dist = "gauss" ,
75- gti = events .gti ,
76- dt = args .bintime ,
77- skip_checks = True ,
78- )
68+ scolor = Lightcurve (
69+ time = time ,
70+ counts = colors ,
71+ err = color_errs ,
72+ input_counts = False ,
73+ err_dist = "gauss" ,
74+ gti = events .gti ,
75+ dt = args .bintime ,
76+ skip_checks = True ,
77+ )
7978
80- if args .outfile is None :
81- label = "_E_"
82- if args .use_pi :
83- label = "_PI_"
84- label += "{3:g}-{2:g}_over_{1:g}-{0:g}" .format (* args .energies )
85- args .outfile = hen_root (f ) + label + HEN_FILE_EXTENSION
86- scolor .e_intervals = np .asarray ([float (k ) for k in args .energies ])
87- scolor .use_pi = args .use_pi
88- save_lcurve (scolor , args .outfile , lctype = "Color" )
89- print (args .outfile )
79+ if args .outfile is None :
80+ label = "_E_"
81+ if args .use_pi :
82+ label = "_PI_"
83+ label += "{3:g}-{2:g}_over_{1:g}-{0:g}" .format (* args .energies )
84+ args .outfile = hen_root (f ) + label + HEN_FILE_EXTENSION
85+ scolor .e_intervals = np .asarray ([float (k ) for k in args .energies ])
86+ scolor .use_pi = args .use_pi
87+ save_lcurve (scolor , args .outfile , lctype = "Color" )
88+ print (args .outfile )
0 commit comments