Skip to content

Commit

Permalink
axes
Browse files Browse the repository at this point in the history
  • Loading branch information
jurjen93 committed Aug 14, 2024
1 parent ba77a97 commit 42b076f
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions subtract/subtract_with_wsclean.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,13 +365,14 @@ def subtract_col(self, out_column: str = None):
for c in range(0, nrows, best_slice):

if c == 0:
print(f'SUBTRACT --> {colmn} {sign} MODEL_DATA')
print(f'Output --> {colmn} {sign} MODEL_DATA')

if not self.onlyprint:
data = ts.getcol(colmn, startrow=c, nrow=best_slice)

if not self.onlyprint:
model = ts.getcol('MODEL_DATA', startrow=c, nrow=best_slice)
ts.putcol(out_column, data - model if self.inverse else data + model, startrow=c, nrow=best_slice)
ts.putcol(out_column, data - model if not self.inverse else data + model, startrow=c, nrow=best_slice)
ts.close()

return self
Expand Down Expand Up @@ -469,7 +470,10 @@ def split_facet_h5(self, h5parm: str = None, dirname: str = None):
os.system(f'cp {h5parm} {outputh5}')

with tables.open_file(outputh5, 'r+') as outh5:
dir_axis = make_utf8(outh5.root.sol000.phase000.val.attrs["AXES"]).split(',').index('dir')

axes = outh5.root.sol000.phase000.val.attrs["AXES"]

dir_axis = make_utf8(axes).split(',').index('dir')

sources = outh5.root.sol000.source[:]
dirs = [make_utf8(dir) for dir in sources['name']]
Expand Down Expand Up @@ -501,6 +505,11 @@ def get_data(soltab, axis):
outh5.create_array('/sol000/amplitude000', 'dir', dirs)
outh5.create_table('/sol000', 'source', new_dirs, title='Source names and directions')

outh5.root.sol000.phase000.val.attrs['AXES'] = bytes(axes, 'utf-8')
outh5.root.sol000.phase000.weight.attrs['AXES'] = bytes(axes, 'utf-8')
outh5.root.sol000.amplitude000.val.attrs['AXES'] = bytes(axes, 'utf-8')
outh5.root.sol000.amplitude000.weight.attrs['AXES'] = bytes(axes, 'utf-8')

return outputh5


Expand Down

0 comments on commit 42b076f

Please sign in to comment.