Skip to content

Commit 11a1b77

Browse files
author
O-Sven
committed
fixed error where image_infos_analysis.csv would be a 1d array if only one line was present
1 parent e41ffc6 commit 11a1b77

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

ledsa/core/_led_helper.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,23 +89,26 @@ def get_img_data(config, build_experiment_infos=False, build_analysis_infos=Fals
8989

9090

9191
def get_img_name(img_id):
92-
infos = load_file('.{}analysis{}image_infos_analysis.csv'.format(sep, sep), ',', 'str', silent=True)
92+
infos = load_file('.{}analysis{}image_infos_analysis.csv'.format(sep, sep), ',', 'str',
93+
silent=True, atleast_2d=True)
9394
for i in range(infos.shape[0]):
9495
if int(infos[i, 0]) == int(img_id):
9596
return infos[i, 1]
9697
raise NameError("Could not find an image name to id {}.".format(img_id))
9798

9899

99100
def get_img_id(img_name):
100-
infos = load_file('.{}analysis{}image_infos_analysis.csv'.format(sep, sep), ',', 'str', silent=True)
101+
infos = load_file('.{}analysis{}image_infos_analysis.csv'.format(sep, sep), ',', 'str',
102+
silent=True, atleast_2d=True)
101103
for i in range(infos.shape[0]):
102104
if infos[i, 1] == img_name:
103105
return infos[i, 0]
104106
raise NameError("Could not find an image id for {}.".format(img_name))
105107

106108

107109
def get_last_img_id():
108-
infos = load_file('.{}analysis{}image_infos_analysis.csv'.format(sep, sep), ',', 'str', silent=True)
110+
infos = load_file('.{}analysis{}image_infos_analysis.csv'.format(sep, sep), ',', 'str',
111+
silent=True, atleast_2d=True)
109112
return int(infos[-1, 0])
110113

111114
# """

0 commit comments

Comments
 (0)