Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Fixed inconsistent indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Oct 12, 2022
1 parent 2560ebd commit a33169d
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions python/swiftest/swiftest/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -910,33 +910,33 @@ def swiftest_particle_2xr(param):
Returns
-------
infoxr : xarray dataset
infoxr : xarray dataset
"""
veclab = ['time_origin', 'xhx_origin', 'py_origin', 'pz_origin', 'vhx_origin', 'vhy_origin', 'vhz_origin']
id_list = []
origin_type_list = []
origin_vec_list = []

try:
with FortranFile(param['PARTICLE_OUT'], 'r') as f:
for id, origin_type, origin_vec in swiftest_particle_stream(f):
id_list.append(id)
origin_type_list.append(origin_type)
origin_vec_list.append(origin_vec)
except IOError:
print(f"Error reading in {param['PARTICLE_OUT']} ")

id_list = np.asarray(id_list)[:,0]
origin_type_list = np.asarray(origin_type_list)
origin_vec_list = np.vstack(origin_vec_list)

typeda = xr.DataArray(origin_type_list, dims=['id'], coords={'id' : id_list})
vecda = xr.DataArray(origin_vec_list, dims=['id', 'vec'], coords={'id' : id_list, 'vec' : veclab})

infoxr = vecda.to_dataset(dim='vec')
infoxr['origin_type'] = typeda

return infoxr
veclab = ['time_origin', 'xhx_origin', 'py_origin', 'pz_origin', 'vhx_origin', 'vhy_origin', 'vhz_origin']
id_list = []
origin_type_list = []
origin_vec_list = []

try:
with FortranFile(param['PARTICLE_OUT'], 'r') as f:
for id, origin_type, origin_vec in swiftest_particle_stream(f):
id_list.append(id)
origin_type_list.append(origin_type)
origin_vec_list.append(origin_vec)
except IOError:
print(f"Error reading in {param['PARTICLE_OUT']} ")

id_list = np.asarray(id_list)[:,0]
origin_type_list = np.asarray(origin_type_list)
origin_vec_list = np.vstack(origin_vec_list)

typeda = xr.DataArray(origin_type_list, dims=['id'], coords={'id' : id_list})
vecda = xr.DataArray(origin_vec_list, dims=['id', 'vec'], coords={'id' : id_list, 'vec' : veclab})

infoxr = vecda.to_dataset(dim='vec')
infoxr['origin_type'] = typeda

return infoxr

def select_active_from_frame(ds, param, framenum=-1):
"""
Expand Down

0 comments on commit a33169d

Please sign in to comment.