Skip to content

Commit

Permalink
Merge 9be2b37 into ce4a739
Browse files Browse the repository at this point in the history
  • Loading branch information
jchiang87 committed Aug 9, 2018
2 parents ce4a739 + 9be2b37 commit f7f4bec
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 20 deletions.
34 changes: 21 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,38 @@ The executables in the `bin` folder should be in your path and so
should be runnable directly from the command line:
```
$ imsim.py --help
usage: imsim.py [-h] [-n NUMROWS] [--outdir OUTDIR] [--sensor SENSOR]
usage: imsim.py [-h] [-n NUMROWS] [--outdir OUTDIR] [--sensors SENSORS]
[--config_file CONFIG_FILE]
[--log_level {DEBUG,INFO,WARN,ERROR,CRITICAL}]
file
[--psf {DoubleGaussian,Kolmogorov,Atmospheric}]
[--disable_sensor_model] [--file_id FILE_ID]
[--create_centroid_file] [--seed SEED] [--processes PROCESSES]
instcat
positional arguments:
file The instance catalog
instcat The instance catalog
optional arguments:
-h, --help show this help message and exit
-n NUMROWS, --numrows NUMROWS
Read the first numrows of the file.
--outdir OUTDIR Output directory for eimage file
--sensor SENSOR Sensor to simulate, e.g., "R:2,2 S:1,1". If None, then
simulate all sensors with sources on them
--sensors SENSORS Sensors to simulate, e.g., "R:2,2 S:1,1^R:2,2 S:1,0".
If None, then simulate all sensors with sources on
them
--config_file CONFIG_FILE
Config file. If None, the default config will be used.
--log_level {DEBUG,INFO,WARN,ERROR,CRITICAL}
Logging level. Default: "INFO"
```

Similarly, by doing `setup imsim`, the `PYTHONPATH` environment
variable has been modified so that the `desc.imsim` module is available:
```
>>> import desc.imsim
>>>
Logging level. Default: INFO
--psf {DoubleGaussian,Kolmogorov,Atmospheric}
PSF model to use. Default: Kolmogorov
--disable_sensor_model
disable sensor effects
--file_id FILE_ID ID string to use for checkpoint and centroid
filenames.
--create_centroid_file
Write centroid file(s).
--seed SEED integer used to seed random number generator
--processes PROCESSES
number of processes to use in multiprocessing mode
```
15 changes: 8 additions & 7 deletions bin.src/imsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,28 @@
import desc.imsim

parser = argparse.ArgumentParser()
parser.add_argument('file', help="The instance catalog")
parser.add_argument('instcat', help="The instance catalog")
parser.add_argument('-n', '--numrows', default=None, type=int,
help="Read the first numrows of the file.")
parser.add_argument('--outdir', type=str, default='fits',
help='Output directory for eimage file')
parser.add_argument('--sensors', type=str, default=None,
help='Sensors to simulate, e.g., "R:2,2 S:1,1^R:2,2 S:1,0".' +
help='Sensors to simulate, e.g., '
'"R:2,2 S:1,1^R:2,2 S:1,0". '
'If None, then simulate all sensors with sources on them')
parser.add_argument('--config_file', type=str, default=None,
help="Config file. If None, the default config will be used.")
parser.add_argument('--log_level', type=str,
choices=['DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL'],
default='INFO', help='Logging level. Default: "INFO"')
default='INFO', help='Logging level. Default: INFO')
parser.add_argument('--psf', type=str, default='Kolmogorov',
choices=['DoubleGaussian', 'Kolmogorov', 'Atmospheric'],
help="PSF model to use.")
help="PSF model to use. Default: Kolmogorov")
parser.add_argument('--disable_sensor_model', default=False,
action='store_true',
help='disable sensor effects')
parser.add_argument('--file_id', type=str, default=None,
help='ID string to use for checkpoint and centroid filenames.')
help='ID string to use for checkpoint filenames.')
parser.add_argument('--create_centroid_file', default=False, action="store_true",
help='Write centroid file(s).')
parser.add_argument('--seed', type=int, default=267,
Expand All @@ -38,7 +39,7 @@
help='number of processes to use in multiprocessing mode')
args = parser.parse_args()

commands = desc.imsim.metadata_from_file(args.file)
commands = desc.imsim.metadata_from_file(args.instcat)

obs_md = desc.imsim.phosim_obs_metadata(commands)

Expand All @@ -50,7 +51,7 @@
apply_sensor_model = not args.disable_sensor_model

image_simulator \
= desc.imsim.ImageSimulator(args.file, psf,
= desc.imsim.ImageSimulator(args.instcat, psf,
numRows=args.numrows,
config=args.config_file,
seed=args.seed,
Expand Down

0 comments on commit f7f4bec

Please sign in to comment.