diff --git a/imcal.py b/imcal.py index 3571699fc108748de77f951ff85026f327daedb5..613ebc9d831ff9e04852d096fdaef9ead3f70065 100755 --- a/imcal.py +++ b/imcal.py @@ -282,15 +282,15 @@ def view_sols(h5param, outname=None): # plt.show() # 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 ---------- model : STR, 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. out : STR, optional 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): ------- None. """ + if level is None: + return model out = out or model logging.warning('Overwriting the model') df = pd.read_csv(model, skipinitialspace=True) - new = df.query('I>@threshold') + new = df.query('I>@level') new.to_csv(out, index=False) return out diff --git a/imcal.yml b/imcal.yml index e28bb2a53b0ac98f43aab8c29826683dc3ea644c..f4f911db88d2be4298ec1b2c208e4bb951623f8a 100644 --- a/imcal.yml +++ b/imcal.yml @@ -25,6 +25,7 @@ clean1: # wsclean setup automask: 20 autothresh: 5 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' dical1: # DPPP setup for direction independent calibration @@ -40,6 +41,7 @@ clean2: automask: 10 autothresh: 5 multiscale: True + clip_model_level: None kwstring: '-use-wgridder -parallel-deconvolution 1400 -parallel-gridding 8 -deconvolution-channels 3' dical2: @@ -55,6 +57,7 @@ clean3: automask: 7 autothresh: 3.5 multiscale: True + clip_model_level: None kwstring: '-use-wgridder -parallel-deconvolution 1400 -parallel-gridding 8 -deconvolution-channels 3' dical3: @@ -70,6 +73,7 @@ clean4: automask: 4.5 autothresh: 0.5 multiscale: True + clip_model_level: None kwstring: '-use-wgridder -parallel-deconvolution 1400 -parallel-gridding 8 -deconvolution-channels 3 -weight briggs 0.0' ####################### CLUSTERING ####################### @@ -100,6 +104,7 @@ clean5: autothresh: 0.5 multiscale: True fitsmask: 'mask2.fits' + clip_model_level: None kwstring: '-use-wgridder -parallel-deconvolution 1400 -parallel-gridding 8 -deconvolution-channels 3 -weight briggs 0.0' ### END