Skip to content

Commit 88e3d7e

Browse files
committed
fix deprecated np.float and np.int
1 parent 3c4a355 commit 88e3d7e

File tree

5 files changed

+7
-10
lines changed

5 files changed

+7
-10
lines changed

allensdk/brain_observatory/behavior/data_objects/stimuli/stimulus_templates.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def _exclude_unseen_pixels(self, arr: np.ndarray):
7676
"""After warping, some pixels are not visible on the screen.
7777
This sets those pixels to nan to make downstream analysis easier."""
7878
mask = self._monitor.get_mask()
79-
arr = arr.astype(np.float)
79+
arr = arr.astype('float')
8080
arr *= mask
8181
arr[mask == 0] = np.nan
8282
return arr

allensdk/brain_observatory/behavior/dprime.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def get_go_responses(hit=None, miss=None, aborted=None):
1515

1616
# Go responses are nan when catch (aborted are masked out); 0 for miss, 1 for hit
1717
# This allows pd.Series.rolling to ignore non-go trial data
18-
go_responses = np.empty_like(hit, dtype=np.float)
18+
go_responses = np.empty_like(hit, dtype='float')
1919
go_responses.fill(float('nan'))
2020
go_responses[hit] = 1
2121
go_responses[miss] = 0
@@ -44,7 +44,7 @@ def get_catch_responses(correct_reject=None, false_alarm=None, aborted=None):
4444

4545
# Catch responses are nan when go (aborted are masked out); 0 for correct-rejection, 1 for false-alarm
4646
# This allows pd.Series.rolling to ignore non-catch trial data
47-
catch_responses = np.empty_like(correct_reject, dtype=np.float)
47+
catch_responses = np.empty_like(correct_reject, dtype='float')
4848
catch_responses.fill(float('nan'))
4949
catch_responses[false_alarm] = 1
5050
catch_responses[correct_reject] = 0

allensdk/brain_observatory/behavior/swdb/summary_figures.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ def plot_max_proj_and_roi_masks(session, save_dir=None):
381381
ax[2].set_title(str(session.metadata['ophys_experiment_id']))
382382

383383
tmp = session.segmentation_mask_image.data.copy()
384-
mask = np.empty(session.segmentation_mask_image.data.shape, dtype=np.float)
384+
mask = np.empty(session.segmentation_mask_image.data.shape, dtype='float')
385385
mask[:] = np.nan
386386
mask[tmp > 0] = 1
387387
cax = ax[2].imshow(mask, cmap='hsv', alpha=0.4, vmin=0, vmax=1)

allensdk/brain_observatory/chisquare_categorical.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ def stim_table_to_categories(stim_table,
8484

8585
category = 0
8686
sweep_categories = -1*np.ones((num_sweeps,))
87-
curr_combination = np.zeros((num_params,),dtype=np.int)
88-
options_per_column = np.array(options_per_column).astype(np.int)
87+
curr_combination = np.zeros((num_params,),dtype='int')
88+
options_per_column = np.array(options_per_column).astype('int')
8989
all_tried = False
9090
while not all_tried:
9191

allensdk/brain_observatory/stimulus_info.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -518,9 +518,6 @@ def lsn_image_to_screen(self, img, stimulus_type, origin='lower', background_col
518518

519519
def natural_scene_image_to_screen(self, img, origin='lower', translation=(0,0)):
520520

521-
# assert img.dtype == np.float32
522-
# img = img.astype(np.uint8)
523-
524521
full_image = np.full((self.n_pixels_r, self.n_pixels_c), 127, dtype=np.uint8)
525522
mr, mc = natural_scene_coordinate_to_monitor_coordinate((0, 0), (self.n_pixels_r, self.n_pixels_c))
526523
Mr, Mc = natural_scene_coordinate_to_monitor_coordinate((img.shape[0], img.shape[1]), (self.n_pixels_r, self.n_pixels_c))
@@ -756,7 +753,7 @@ def warp_stimulus_coords(vertices,
756753
distance = float(distance)
757754
mon_res_x, mon_res_y = float(mon_res[0]), float(mon_res[1])
758755

759-
vertices = vertices.astype(np.float)
756+
vertices = vertices.astype('float')
760757

761758
# from pixels (-1920/2 -> 1920/2) to stimulus space (-0.5->0.5)
762759
vertices[:, 0] = vertices[:, 0] / mon_res_x

0 commit comments

Comments
 (0)