# Skip frames before the start frame (FIXME). if frame_count < start_frame_number: frame_count += 1 continue # Quit if we're at the end of the file or frame count. if not bs or frame_count > (n_frames_to_process + start_frame_number - 1): break ## The frame's data - 8 bytes, eh? Nice. data = struct.unpack("IhH", bs) ## The start time (seconds since epoch) - 4 byte unsigned integer. start_time_s = data[0] lg.info(" *--> Frame start time %15d [s] -> '%s' (UTC)" % (start_time_s, make_time_dir(start_time_s))) ## The acquisition time (decoded 2 byte signed integer). #acq_time = math.pow(10, int(data[1])) acq_time = int(data[1]) ## The number of hit pixels (2 byte unsigned integer). n_pixels = int(data[2]) # Check if the start time is within the day. if day_start_s <= start_time_s <= day_end_s: my_day.addFrame(start_time_s, acq_time, n_pixels) frame_count += 1 ## The number of frames processed - check.
## The chip ID. chip_id = frames[0].getChipId() # The start time of the first frame. run_start_time_sec = frames[0].getStartTimeSec() # The end time of the last frame. run_end_time_sec = frames[-1].getStartTimeSec() # run_end_time_sec += frames[-1].getAcqTime() ## The run length [s]. run_length_sec = run_end_time_sec - run_start_time_sec ## The Run ID. run_id = "%s_%s" % (chip_id, make_time_dir(run_start_time_sec)) lg.info(" * Chip ID : '%s'." % (chip_id)) lg.info(" *") lg.info(" * Start time (sec) : % 15d [s]." % (run_start_time_sec)) lg.info(" * => '%s'" % (make_time_dir(run_start_time_sec))) lg.info(" * End time (sec) : % 15d [s]." % (run_end_time_sec)) lg.info(" * => '%s'" % (make_time_dir(run_end_time_sec))) lg.info(" * Run length (sec) : % 15d [s]." % (run_length_sec)) lg.info(" * Run length (min) : % 15.2f [min.]." % (float(run_length_sec)/60.0)) lg.info(" *") lg.info(" * Run ID : '%s'." % (run_id)) lg.info(" *") ## The name of the dataset profile binary file. output_file_name = os.path.join(outputpath, "%s.bin" % (run_id))