Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if len(hdulist[hduname].data[ratecolumn].shape) != 1 \
or not (isinstance(hdulist[hduname].data[ratecolumn][0], int) \
or isinstance(hdulist[hduname].data[ratecolumn][0], np.integer) \
or isinstance(hdulist[hduname].data[ratecolumn][0], float) \
or isinstance(hdulist[hduname].data[ratecolumn][0], np.floating)):
logging.warn("Wrong data type found for column: " + str(ratecolumn) + " in " + str(hduname) + " HDU, expected Integer or Float.")
return None
header, header_comments = get_header(hdulist, hduname)
# Reads the lightcurve with HENDRICS
outfile = lcurve_from_fits(destination, gtistring=get_hdu_string_from_hdulist(gtistring, hdulist),
timecolumn=column, ratecolumn=ratecolumn, ratehdu=1,
fracexp_limit=CONFIG.FRACEXP_LIMIT)[0]
lcurve, events_start_time = substract_tstart_from_lcurve(load_data(outfile), time_offset)
dataset = DataSet.get_lightcurve_dataset_from_stingray_lcurve(lcurve, header, header_comments,
hduname, column)
# Stores the events_start_time in time column extra
dataset.tables[hduname].columns[column].set_extra("TSTART", events_start_time)
logging.debug("Read Lightcurve fits with stingray file successfully: " + str(destination) + ", tstart: " + str(events_start_time) + ", rate: " + str(len(lcurve["counts"])))
return dataset