Skip to content
Snippets Groups Projects
Commit acc3a3d5 authored by Alexander Kutkin's avatar Alexander Kutkin
Browse files

add option to clip model after cleaning

parent 28c8aa3a
No related branches found
No related tags found
No related merge requests found
...@@ -282,15 +282,15 @@ def view_sols(h5param, outname=None): ...@@ -282,15 +282,15 @@ def view_sols(h5param, outname=None):
# plt.show() # plt.show()
# TODO # TODO
def model_apply_threshold(model, threshold=0.0, out=None): def remove_model_components_below_level(model, level=0.0, out=None):
""" """
Clip the model to be above the given threshold Clip the model to be above the given level
Parameters Parameters
---------- ----------
model : STR, model file name model : STR, model file name
the input model file name the input model file name
threshold : FLOAT, optional level : FLOAT, optional
the threshold above which the components are kept. The default is 0.0. the threshold above which the components are kept. The default is 0.0.
out : STR, optional out : STR, optional
The output model filename. The default is None (the model file will be overwritten). The output model filename. The default is None (the model file will be overwritten).
...@@ -299,10 +299,12 @@ def model_apply_threshold(model, threshold=0.0, out=None): ...@@ -299,10 +299,12 @@ def model_apply_threshold(model, threshold=0.0, out=None):
------- -------
None. None.
""" """
if level is None:
return model
out = out or model out = out or model
logging.warning('Overwriting the model') logging.warning('Overwriting the model')
df = pd.read_csv(model, skipinitialspace=True) df = pd.read_csv(model, skipinitialspace=True)
new = df.query('I>@threshold') new = df.query('I>@level')
new.to_csv(out, index=False) new.to_csv(out, index=False)
return out return out
......
...@@ -25,6 +25,7 @@ clean1: # wsclean setup ...@@ -25,6 +25,7 @@ clean1: # wsclean setup
automask: 20 automask: 20
autothresh: 5 autothresh: 5
multiscale: False multiscale: False
clip_model_level: None # use a float number to clip the model to above this level
kwstring: '-use-wgridder -parallel-deconvolution 1400' # use this for additional wsclean options, e.g. '-weight uniform -use-idg' kwstring: '-use-wgridder -parallel-deconvolution 1400' # use this for additional wsclean options, e.g. '-weight uniform -use-idg'
dical1: # DPPP setup for direction independent calibration dical1: # DPPP setup for direction independent calibration
...@@ -40,6 +41,7 @@ clean2: ...@@ -40,6 +41,7 @@ clean2:
automask: 10 automask: 10
autothresh: 5 autothresh: 5
multiscale: True multiscale: True
clip_model_level: None
kwstring: '-use-wgridder -parallel-deconvolution 1400 -parallel-gridding 8 -deconvolution-channels 3' kwstring: '-use-wgridder -parallel-deconvolution 1400 -parallel-gridding 8 -deconvolution-channels 3'
dical2: dical2:
...@@ -55,6 +57,7 @@ clean3: ...@@ -55,6 +57,7 @@ clean3:
automask: 7 automask: 7
autothresh: 3.5 autothresh: 3.5
multiscale: True multiscale: True
clip_model_level: None
kwstring: '-use-wgridder -parallel-deconvolution 1400 -parallel-gridding 8 -deconvolution-channels 3' kwstring: '-use-wgridder -parallel-deconvolution 1400 -parallel-gridding 8 -deconvolution-channels 3'
dical3: dical3:
...@@ -70,6 +73,7 @@ clean4: ...@@ -70,6 +73,7 @@ clean4:
automask: 4.5 automask: 4.5
autothresh: 0.5 autothresh: 0.5
multiscale: True multiscale: True
clip_model_level: None
kwstring: '-use-wgridder -parallel-deconvolution 1400 -parallel-gridding 8 -deconvolution-channels 3 -weight briggs 0.0' kwstring: '-use-wgridder -parallel-deconvolution 1400 -parallel-gridding 8 -deconvolution-channels 3 -weight briggs 0.0'
####################### CLUSTERING ####################### ####################### CLUSTERING #######################
...@@ -100,6 +104,7 @@ clean5: ...@@ -100,6 +104,7 @@ clean5:
autothresh: 0.5 autothresh: 0.5
multiscale: True multiscale: True
fitsmask: 'mask2.fits' fitsmask: 'mask2.fits'
clip_model_level: None
kwstring: '-use-wgridder -parallel-deconvolution 1400 -parallel-gridding 8 -deconvolution-channels 3 -weight briggs 0.0' kwstring: '-use-wgridder -parallel-deconvolution 1400 -parallel-gridding 8 -deconvolution-channels 3 -weight briggs 0.0'
### END ### END
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment