forked from gammapy/gammapy
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix missing parameter and call of non-existing method in image_ts.py
- Loading branch information
1 parent
424551c
commit 7165503
Showing
1 changed file
with
2 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,9 +37,6 @@ def image_ts_main(args=None): | |
"using the '--model' parameter.") | ||
parser.add_argument('--model', type=str, | ||
help='Input excess model FITS file name') | ||
parser.add_argument('--threshold', type=float, default=None, | ||
help="Minimal required initial (before fitting) TS value," | ||
This comment has been minimized.
Sorry, something went wrong. |
||
" that the fit is done at all.") | ||
parser.add_argument('--overwrite', action='store_true', | ||
help='Overwrite output files.') | ||
parser.add_argument("-l", "--loglevel", default='info', | ||
|
@@ -81,17 +78,14 @@ def image_ts(input_file, output_file, psf, model, scales, downsample, residual, | |
results = compute_ts_map_multiscale(maps, psf_parameters, scales, downsample, | ||
residual, morphology, width) | ||
|
||
# TODO: changed to `Path` ... untested! | ||
folder, filename = Path(output_file).split() | ||
Path(folder).mkdir(exist_ok=False) | ||
|
||
|
||
# Write results to file | ||
This comment has been minimized.
Sorry, something went wrong.
OlgaVorokh
Author
Owner
|
||
header = maps[0].header | ||
if len(results) > 1: | ||
for scale, result in zip(scales, results): | ||
# TODO: this is unnecessarily complex | ||
# Simplify, e.g. by letting the user specify a `base_dir`. | ||
filename_ = filename.replace('.fits', '_{0:.3f}.fits'.format(scale)) | ||
filename_ = output_file.replace('.fits', '_{0:.3f}.fits'.format(scale)) | ||
fn = Path(folder) / filename_ | ||
log.info('Writing {}'.format(fn)) | ||
result.write(str(fn), header, overwrite=overwrite) | ||
|
it conflicted with the signature of image_ts
def image_ts(input_file, output_file, psf, model, scales, downsample, residual,
morphology, width, overwrite):
I did a small investigation: the image_ts used to have a threshold parameter, but then it got deleted(not sure when since file was renamed and github.com history only works if you don't move file around)
I found an old commit gammapy@67c0bad where compute_ts_map have been replaced by compute_ts_map_multiscale, which doesn't have "threshold" parameter.
Based on this I believe threshold is not needed anymore.