Open hayesla opened 2 weeks ago
like a simple solution would be something like:
pixel_starts = pixel_data.times - pixel_data.durtaion/2
pixel_ends = pixel_data.times + pixel_data.durtaion/2
t_mask = (pixel_starts >= Time(time_range[0])) & (pixel_ends <= Time(time_range[1]))
what do you think @samaloney ?
We also need to consider bins where the time range is inside the bin edges so I think the following three cases should work
t_mask_1 = (pixel_starts >= Time(time_range[0])) & (pixel_ends <= Time(time_range[1]))
t_mask_2 = (Time(time_range[0]) - pixel_starts < pixel_data.durtaion) & (Time(time_range[0]) - pixel_starts > 0 * u.s)
t_mask_3 = (pixel_ends - Time(time_range[1]) < pixel_data.durtaion) & (pixel_ends - Time(time_range[0]) > 0 * u.s)
t_mask = np.logical_or(t_mask_1, t_mask_2, t_mask_3)
Yes I think this is similar to what we currently do in the client but for file start/end
I'm down to one hand for a while, broken finger, so things are a bit slow myside.
Currently, in
create_meta_pixels
to find the data that is contained within the times and energies, only the center of the time bins are checked.For example here: https://github.com/TCDSolar/stixpy/blob/main/stixpy/calibration/visibility.py#L119
the time-range passed is only checked against the center time of the data bins. However, if the bins are large (e.g. 20s or something), then the time-range passed could be within the bin, however it isn't satisfied by the center value.
For example: In this extreme example, this data only have one time bin, which is quite large (890s). Following the logic from L119 from the visibility.py, this isn't satisfied
however, its just because the center of the time bin is:
however the passed time_range is within the bin of the data (here as its only one time point):
so it really should be checking that the passed time range is withing the edge of the bins, something like pixel.start_times and pixel.end_times? This could be inferred from the duration.
For context, this is what the IDL software does as far as I know.