Skip to content

Commit ee7a179

Browse files
authored
Updates for numpy2 (#438)
Update code for changes in Numpy2.x
1 parent de06abc commit ee7a179

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

stixcore/processing/tests/test_processing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def out_dir(tmp_path):
5454

5555
@pytest.fixture
5656
def packet():
57-
data = "0da4c0090066100319000000000000000212000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b788014000000000ffffffff000000000000000000000000000000000000000000000000000000001f114cffffff" # noqa:
57+
data = "0da4c0090066100319000000000000000212000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b788014000000000ffffffff000000000000000000000000000000000000000000000000000000001f114cffffff" # noqa
5858
packet = GenericTMPacket("0x" + data)
5959
return packet
6060

stixcore/products/level0/quicklookL0.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def from_levelb(cls, levelb, *, parent="", NIX00405_offset=0):
104104
# When the packets are parsed empty packets are dropped but in LB we don't parse so this
105105
# is not known need to compare control and levelb.control and only use matching rows
106106
if len(levelb.control) > len(control):
107-
matching_index = np.argwhere(np.in1d(levelb.control["scet_coarse"], np.array(packets.get("scet_coarse"))))
107+
matching_index = np.argwhere(np.isin(levelb.control["scet_coarse"], np.array(packets.get("scet_coarse"))))
108108
control["raw_file"] = levelb.control["raw_file"][matching_index].reshape(-1)
109109
control["packet"] = levelb.control["packet"][matching_index].reshape(-1)
110110
else:
@@ -842,7 +842,7 @@ def from_levelb(cls, levelb, parent=""):
842842
# When the packets are parsed empty packets are dropped but in LB we don't parse so this
843843
# is not known need to compare control and levelb.control and only use matching rows
844844
if len(levelb.control) > len(control):
845-
matching_index = np.argwhere(np.in1d(levelb.control["scet_coarse"], np.array(packets.get("scet_coarse"))))
845+
matching_index = np.argwhere(np.isin(levelb.control["scet_coarse"], np.array(packets.get("scet_coarse"))))
846846
control["raw_file"] = levelb.control["raw_file"][matching_index].reshape(-1)
847847
control["packet"] = levelb.control["packet"][matching_index].reshape(-1)
848848
else:

stixcore/products/level0/scienceL0.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def split_to_files(self):
157157
key_cols.insert(0, "tc_packet_seq_control")
158158

159159
for control in self.control.group_by(key_cols).groups:
160-
data = self.data[np.in1d(self.data["control_index"], control["index"])]
160+
data = self.data[np.isin(self.data["control_index"], control["index"])]
161161

162162
yield type(self)(
163163
service_type=self.service_type,
@@ -375,7 +375,7 @@ def from_levelb(cls, levelb, parent=""):
375375
start = 0
376376
end = 0
377377
res = []
378-
for npx in data["num_pixel_sets"]:
378+
for npx in data["num_pixel_sets"].astype(int):
379379
end += npx
380380
cur_pm = pixel_indices[start:end].astype(int).tolist()
381381
full_pm = np.full((12), 0, dtype=np.ubyte)

0 commit comments

Comments
 (0)