jcbird / ppv

Tools for dealing with SDSS-V plate files and plate runs.
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

BHM_03 issue #18

Closed eleonorazari closed 3 years ago

eleonorazari commented 3 years ago

Hi Jon, I am vetting BHM_03 with five_plates. Everything is fine except when I give this command:

observed = ob_targets.assigned_in(platerun_bhm3) obs = ob_targets.data[observed]

which returns:

Please be patient. Initial target loading can take up to 1 second per field. Loading target data from 18 Fields...


AttributeError Traceback (most recent call last) ~/ppv/src/ppv/fiveplates.py in targets(self) 433 try: --> 434 return self._targets 435 except AttributeError:

AttributeError: 'Platerun' object has no attribute '_targets'

During handling of the above exception, another exception occurred:

AttributeError Traceback (most recent call last) ~/ppv/src/ppv/fiveplates.py in targets(self) 267 try: --> 268 return self._plateinput 269 except AttributeError:

AttributeError: 'Field' object has no attribute '_plateinput'

During handling of the above exception, another exception occurred:

MergeConflictError Traceback (most recent call last) ~/anaconda3/envs/ppv/lib/python3.8/site-packages/astropy/table/operations.py in _vstack(arrays, join_type, col_name_map, metadata_conflicts) 1299 try: -> 1300 col = col_cls.info.new_like(cols, n_rows, metadata_conflicts, out_name) 1301 except metadata.MergeConflictError as err:

~/anaconda3/envs/ppv/lib/python3.8/site-packages/astropy/table/column.py in new_like(self, cols, length, metadata_conflicts, name) 326 """ --> 327 attrs = self.merge_cols_attributes(cols, metadata_conflicts, name, 328 ('meta', 'unit', 'format', 'description'))

~/anaconda3/envs/ppv/lib/python3.8/site-packages/astropy/utils/data_info.py in merge_cols_attributes(cols, metadata_conflicts, name, attrs) 675 # Output dtype is the superset of all dtypes in in_cols --> 676 out['dtype'] = metadata.common_dtype(cols) 677

~/anaconda3/envs/ppv/lib/python3.8/site-packages/astropy/utils/metadata.py in common_dtype(arrs) 64 tme._incompat_types = incompat_types ---> 65 raise tme 66

MergeConflictError: Arrays have incompatible types ['int64', 'object', 'object', 'int64', 'int64', 'int64', 'int64', 'int64', 'int64', 'int64', 'int64', 'int64', 'int64', 'int64', 'int64', 'int64', 'int64', 'int64', 'int64']

During handling of the above exception, another exception occurred:

TableMergeError Traceback (most recent call last)

in 1 #observed = ob_targets.assigned_in(plate_run_2020_12_a) ----> 2 observed = ob_targets.assigned_in(platerun_bhm3) 3 obs = ob_targets.data[observed] ~/ppv/src/ppv/targets.py in assigned_in(self, pl_field_plrun, table) 156 """ 157 indx_key = (pl_field_plrun.name, table) --> 158 _lookin_table = getattr(pl_field_plrun, table) 159 indx = self._assigned_indx.get(indx_key, 160 self._within(_lookin_table['catalogid'])) ~/ppv/src/ppv/fiveplates.py in targets(self) 437 Initial target loading can take up to 1 second per field. 438 Loading target data from {len(self.fieldnames)} Fields...""") --> 439 self._targets = self._load_table() 440 return self._targets 441 ~/ppv/src/ppv/fiveplates.py in _load_table(self) 445 """ 446 --> 447 table = vstack([field.targets for field in self.fields]) 448 table.sort('catalogid') 449 return table ~/ppv/src/ppv/fiveplates.py in (.0) 445 """ 446 --> 447 table = vstack([field.targets for field in self.fields]) 448 table.sort('catalogid') 449 return table ~/ppv/src/ppv/fiveplates.py in targets(self) 268 return self._plateinput 269 except AttributeError: --> 270 self._plateinput = self._full_plateinput_table() 271 return self._plateinput 272 ~/ppv/src/ppv/fiveplates.py in _full_plateinput_table(self) 254 targetlist_file in _plateinput_filenames if 255 'apogee_STA' not in targetlist_file] --> 256 full_table = vstack(plinput_tables) 257 full_table.rename_column('Catalog_id', 'catalogid') 258 full_table.sort('catalogid') ~/anaconda3/envs/ppv/lib/python3.8/site-packages/astropy/table/operations.py in vstack(tables, join_type, metadata_conflicts) 637 col_name_map = OrderedDict() 638 --> 639 out = _vstack(tables, join_type, col_name_map, metadata_conflicts) 640 641 # Merge table metadata ~/anaconda3/envs/ppv/lib/python3.8/site-packages/astropy/table/operations.py in _vstack(arrays, join_type, col_name_map, metadata_conflicts) 1302 # Beautify the error message when we are trying to merge columns with incompatible 1303 # types by including the name of the columns that originated the error. -> 1304 raise TableMergeError("The '{}' columns have incompatible types: {}" 1305 .format(out_name, err._incompat_types)) 1306 TableMergeError: The 'order_priority' columns have incompatible types: ['int64', 'object', 'object', 'int64', 'int64', 'int64', 'int64', 'int64', 'int64', 'int64', 'int64', 'int64', 'int64', 'int64', 'int64', 'int64', 'int64', 'int64', 'int64'] Cheers, Eleonora
jcbird commented 3 years ago

There was a typo in five_plates. I have a pull request (sdss/five_plates#33) in now to fix this. I will update this issue as soon as it is accepted!

jcbird commented 3 years ago

PR was accepted! Just go a new pull of the five_plates repo and you should be good to go!

eleonorazari commented 3 years ago

Perfect, thanks!