#for c in range(nsb):
                #  if (sb.mask[c]&MaskCode.Valid == MaskCode.Valid and sb.mask[c]&MaskCode.Foreground == MaskCode.Foreground):
                #    values[c]=0.
                v0 = values.set_selected(values <= 0, 0.)
                v1 = v0.set_selected(v0 > 255, 255)
                v2 = (256. - v1) / 256.
                np_v2 = np.ndarray(shape=(
                    B[3] - B[2],
                    B[1] - B[0],
                ),
                                   dtype=np.float32,
                                   buffer=v2.as_numpy_array())

                # insert code here to estimate the partiality response
                pr_value = get_partiality_response(key,
                                                   one_index,
                                                   spectra_simulation=SS,
                                                   ROI=ROI)
                print("NSB2", nsb)
                for c in range(nsb):
                    intensity_lookup_1[(int(sb.coords()[c][1]),
                                        int(sb.coords()[c][0]))] = pr_value[c]
                assert len(intensity_lookup_1) == len(intensity_lookup)
                assert len(pr_value) == len(sb.data)

                values_1 = pr_value  # sb.data # ADU
                v0_1 = values_1.set_selected(values_1 <= 0, 0.)
                v1_1 = v0_1.set_selected(v0_1 > 255, 255)
                v2_1 = (256. - v1_1) / 256.
                np_v2_1 = np.ndarray(shape=(
                    B[3] - B[2],
                    B[1] - B[0],
示例#2
0
                # intensity_lookup consists of the "observed" data from shoeboxes

                v0 = values.set_selected(values <= 0, 0.)
                v1 = v0.set_selected(v0 > 255, 255)
                v2 = (256. - v1) / 256.
                np_v2 = np.ndarray(shape=(
                    B[3] - B[2],
                    B[1] - B[0],
                ),
                                   dtype=np.float32,
                                   buffer=v2.as_numpy_array())

                # insert code here to estimate the partiality response
                PRD = get_partiality_response(
                    key,
                    hkl[x],
                    spectra_simulation=transmitted_info["spectra"],
                    ROI=ROI)
                pr_value = PRD["roi_pixels"]
                miller = PRD["miller"]
                intensity = PRD["intensity"]

                for c in range(nsb):
                    intensity_lookup_1[(int(sb.coords()[c][1]),
                                        int(sb.coords()[c][0]))] = pr_value[c]
                assert len(intensity_lookup_1) == len(intensity_lookup)
                assert len(pr_value) == len(sb.data)
                # intensity_lookup_1 consists of partiality model data from posthoc simulator (partiality x Icalc)

                values_1 = pr_value  # sb.data # ADU
                v0_1 = values_1.set_selected(values_1 <= 0, 0.)