Skip to content

Commit 2786b1f

Browse files
committed
read in uniqueIds as strings; update tiny_instcat.txt with explicit string object id
1 parent ac5de90 commit 2786b1f

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

python/desc/imsim/imSim.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def sources_from_list(object_lines, obs_md, phot_params, file_name):
183183
rotation_angle = np.zeros(num_objects, dtype=float)
184184
fits_image_file = dict()
185185

186-
unique_id = np.zeros(num_objects, dtype=int)
186+
unique_id = [None]*num_objects
187187
object_type = np.zeros(num_objects, dtype=int)
188188

189189
i_obj = -1
@@ -192,7 +192,7 @@ def sources_from_list(object_lines, obs_md, phot_params, file_name):
192192
if params[0] != 'object':
193193
continue
194194
i_obj += 1
195-
unique_id[i_obj] = int(params[1])
195+
unique_id[i_obj] = params[1]
196196
ra_phosim[i_obj] = float(params[2])
197197
dec_phosim[i_obj] = float(params[3])
198198
mag_norm[i_obj] = float(params[4])

tests/test_instcat_parser.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,11 @@ def test_object_extraction_stars(self):
151151
phot_params,
152152
self.phosim_file)
153153

154-
id_arr = np.zeros(len(gs_object_arr), dtype=int)
154+
id_arr = [None]*len(gs_object_arr)
155155
for i_obj in range(len(gs_object_arr)):
156156
id_arr[i_obj] = gs_object_arr[i_obj].uniqueId
157157

158-
truth_dtype = np.dtype([('uniqueId', int), ('x_pupil', float), ('y_pupil', float),
158+
truth_dtype = np.dtype([('uniqueId', str, 200), ('x_pupil', float), ('y_pupil', float),
159159
('sedFilename', str, 200), ('magNorm', float),
160160
('raJ2000', float), ('decJ2000', float),
161161
('pmRA', float), ('pmDec', float),
@@ -253,11 +253,11 @@ def test_object_extraction_galaxies(self):
253253
phot_params,
254254
galaxy_phosim_file)
255255

256-
id_arr = np.zeros(len(gs_object_arr), dtype=int)
256+
id_arr = [None]*len(gs_object_arr)
257257
for i_obj in range(len(gs_object_arr)):
258258
id_arr[i_obj] = gs_object_arr[i_obj].uniqueId
259259

260-
truth_dtype = np.dtype([('uniqueId', int), ('x_pupil', float), ('y_pupil', float),
260+
truth_dtype = np.dtype([('uniqueId', str, 200), ('x_pupil', float), ('y_pupil', float),
261261
('sedFilename', str, 200), ('magNorm', float),
262262
('raJ2000', float), ('decJ2000', float),
263263
('redshift', float), ('gamma1', float),
@@ -424,9 +424,10 @@ def test_validate_phosim_object_list(self):
424424
message = wa[desired_warning_dex].message.args[0]
425425

426426
# these are the objects that should be omitted
427-
bad_unique_ids = set([34307989098524, 811883374597,
427+
bad_unique_ids = set([str(x) for x in
428+
[34307989098524, 811883374597,
428429
811883374596, 956090392580,
429-
34307989098523, 34304522113056])
430+
34307989098523, 34304522113056]])
430431

431432
self.assertIn('Omitted 6 suspicious objects', message)
432433
self.assertIn('4 had galactic_Av', message)

tests/tiny_instcat.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ seed 161899
1818
seeing 0.7613760
1919
sunalt -59.1098785
2020
vistime 33.0000000
21-
object 1046817878020 31.2400746 -10.09365 29.3370237 starSED/phoSimMLT/lte033-4.5-1.0a+0.4.BT-Settl.spec.gz 0 0 0 0 0 0 point none CCM 0.0635117705 3.1
21+
object MS_567_8 31.2400746 -10.09365 29.3370237 starSED/phoSimMLT/lte033-4.5-1.0a+0.4.BT-Settl.spec.gz 0 0 0 0 0 0 point none CCM 0.0635117705 3.1
2222
object 811883456516 31.2338048 -10.0578789 26.9267056 starSED/phoSimMLT/lte027-2.0-0.0a+0.0.BT-Settl.spec.gz 0 0 0 0 0 0 point none CCM 0.0630700848 3.1
2323
object 1046816368644 31.2371416 -10.0554117 28.7153047 starSED/phoSimMLT/lte027-2.0-0.0a+0.0.BT-Settl.spec.gz 0 0 0 0 0 0 point none CCM 0.0630379733 3.1
2424
object 1046816356356 31.2305508 -10.0620637 26.7932237 starSED/phoSimMLT/lte033-4.5-1.0a+0.4.BT-Settl.spec.gz 0 0 0 0 0 0 point none CCM 0.0631214889 3.1

0 commit comments

Comments
 (0)