Skip to content

Commit

Permalink
fix vsini
Browse files Browse the repository at this point in the history
allow list of Nones
  • Loading branch information
segasai committed Nov 16, 2024
1 parent 1e725eb commit c3fa2e3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion py/rvspecfit/make_ccf.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def preprocess_model_list(lammodels,
pool.close()
pool.join()
retparams = np.array(retparams)
vsinisList = np.array(vsinisList)
vsinisList = vsinisList
res = np.array(res)
return res, retparams, vsinisList

Expand Down
6 changes: 4 additions & 2 deletions py/rvspecfit/serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ def recursively_save_dict_contents_to_group(h5file,
h5file[key_path].attrs['type'] = 'None'
elif isinstance(item, (list, tuple)):
is_list = isinstance(item, list)
if all(isinstance(x, type(item[0]))
for x in item): # Ensure all elements are of the same type
if all(isinstance(x, type(item[0])) for x in item) and item[
0] is not None: # Ensure all elements are of the same type
arr = np.array(item)
if arr.dtype.char == 'U':
ds = h5file.create_dataset(key_path,
Expand Down Expand Up @@ -209,10 +209,12 @@ def test_code():
'tuple_data': (np.int64(1), np.int64(2), np.int64(3)),
'list_data': [1.1, 2.2, 3.3],
'xliststr': ['test', 'example'],
'xliststr1': [np.str_('test'), np.str_('example')],
'qq': np.array(['x', 'y', 'z']),
'a1': [],
'a2': tuple(),
'a3': (np.int64(1), 'x'),
'a4': [None, None, np.int64(3)],
'myclass': TestClass(1, 2)
}

Expand Down

0 comments on commit c3fa2e3

Please sign in to comment.