Skip to content

Commit

Permalink
read in uniqueIds as strings; update tiny_instcat.txt with explicit s…
Browse files Browse the repository at this point in the history
…tring object id
  • Loading branch information
jchiang87 committed Sep 12, 2018
1 parent ac5de90 commit 2786b1f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions python/desc/imsim/imSim.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def sources_from_list(object_lines, obs_md, phot_params, file_name):
rotation_angle = np.zeros(num_objects, dtype=float)
fits_image_file = dict()

unique_id = np.zeros(num_objects, dtype=int)
unique_id = [None]*num_objects
object_type = np.zeros(num_objects, dtype=int)

i_obj = -1
Expand All @@ -192,7 +192,7 @@ def sources_from_list(object_lines, obs_md, phot_params, file_name):
if params[0] != 'object':
continue
i_obj += 1
unique_id[i_obj] = int(params[1])
unique_id[i_obj] = params[1]
ra_phosim[i_obj] = float(params[2])
dec_phosim[i_obj] = float(params[3])
mag_norm[i_obj] = float(params[4])
Expand Down
13 changes: 7 additions & 6 deletions tests/test_instcat_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,11 @@ def test_object_extraction_stars(self):
phot_params,
self.phosim_file)

id_arr = np.zeros(len(gs_object_arr), dtype=int)
id_arr = [None]*len(gs_object_arr)
for i_obj in range(len(gs_object_arr)):
id_arr[i_obj] = gs_object_arr[i_obj].uniqueId

truth_dtype = np.dtype([('uniqueId', int), ('x_pupil', float), ('y_pupil', float),
truth_dtype = np.dtype([('uniqueId', str, 200), ('x_pupil', float), ('y_pupil', float),
('sedFilename', str, 200), ('magNorm', float),
('raJ2000', float), ('decJ2000', float),
('pmRA', float), ('pmDec', float),
Expand Down Expand Up @@ -253,11 +253,11 @@ def test_object_extraction_galaxies(self):
phot_params,
galaxy_phosim_file)

id_arr = np.zeros(len(gs_object_arr), dtype=int)
id_arr = [None]*len(gs_object_arr)
for i_obj in range(len(gs_object_arr)):
id_arr[i_obj] = gs_object_arr[i_obj].uniqueId

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

# these are the objects that should be omitted
bad_unique_ids = set([34307989098524, 811883374597,
bad_unique_ids = set([str(x) for x in
[34307989098524, 811883374597,
811883374596, 956090392580,
34307989098523, 34304522113056])
34307989098523, 34304522113056]])

self.assertIn('Omitted 6 suspicious objects', message)
self.assertIn('4 had galactic_Av', message)
Expand Down
2 changes: 1 addition & 1 deletion tests/tiny_instcat.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ seed 161899
seeing 0.7613760
sunalt -59.1098785
vistime 33.0000000
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
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
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
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
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
Expand Down

0 comments on commit 2786b1f

Please sign in to comment.