The sotrp-coadd command (sotrplib/coadd_cli.py) makes one coadd from the
depth-1 maps that its config selects. See Coadds: overview for
the data flow.
To make coadds for many time windows, use the helper script
submit_week_coadds.py (see Helper scripts). The script writes
the configs that this page describes.
-
Set the environment variables (see "Environment" below).
-
Write a config file (see "Config" below).
-
Run the command:
sotrp-coadd -c config.json
The command has one option, -c, for the config file.
Each input map takes approximately 5 to 6 minutes. The memory use is approximately 7 GB, and it does not increase with the number of maps.
sotrp-coadd uses these mapcat environment variables:
export MAPCAT_DATABASE_NAME=/path/to/mapcat.sqlite
export MAPCAT_DEPTH_ONE_PARENT=/path/to/depth1/maps # depth-1 paths are relative to this
export MAPCAT_DEPTH_ONE_COADD_PARENT=/path/to/coadds # coadd paths are relative to this
Depth-1 maps and coadds have different root directories. Thus, you can keep the coadds in your own data directory, and the depth-1 maps in a shared directory.
- If
MAPCAT_DEPTH_ONE_COADD_PARENTis not set, its value is the current directory.sotrp-coadddoes not useMAPCAT_DEPTH_ONE_PARENTin its place. - Each output directory must be in
MAPCAT_DEPTH_ONE_COADD_PARENT.sotrp-coadddoes this check before the coadd work starts. If the check fails, the error message gives the name of the variable.
The asteroid mask uses SOCat. Set these variables:
export socat_client_client_type=db
export socat_model_database_name=/path/to/socat.db
sotrp-coadd reads a CoaddSettings JSON file (sotrplib/config/coadd.py).
sample_coadd_config.json is a full example for one week of f090 maps.
| Field | Meaning |
|---|---|
maps |
The depth-1 maps for the coadd. Use the mapcat_database generator with map_type: "intensity" (raw maps). See "Select the maps" below. |
preprocessors |
The preprocessors to apply, in sequence, to each depth-1 map before the merge. See "Preprocessors" below. |
map_coadder |
The method that merges the maps: {"coadd_type": "rhokappa"}. |
map_outputs |
The coadd fields to write to FITS, and the output directory. See "Outputs" below. |
mapcat_registration |
coadd_name, coadd_type and enabled. See "Registration in mapcat" below. |
The maps generator selects depth-1 maps from mapcat with these fields:
frequency(necessary).start_timeandend_time: the time window.array(optional): the maps of one array only. If you do not set it, the coadd contains the maps of all arrays of the band.time_binning: how the generator compares a map with the time window.
The observation of a depth-1 map can start in one window and stop in the
next window. The time_binning field sets the window that gets this map:
| Mode | The window includes a map if... | A map that crosses a window boundary... |
|---|---|---|
left-bound |
its start_time is in [start, end) |
goes into one window only |
right-bound |
its stop_time is in [start, end) |
goes into one window only |
restrictive |
all of the map is in the window | goes into no window |
loose (default) |
a part of the map is in the window | goes into the two windows |
For a set of adjacent windows, use left-bound or right-bound. Then each
map is in one coadd only, and there are no gaps.
sotrp-coadd applies the preprocessors to each depth-1 map before the merge.
Use the same preprocessor configs as for sotrp (sotrplib/config/preprocessors.py).
This sequence is typical (see sample_coadd_config.json):
planet_mask: masks the planets (15 arcmin).asteroid_mask: masks the asteroids from SOCat (10 arcmin). If SOCat is not available, it can use a local ephemeris file (ephem_file_path).matched_filter: applies the matched filter and makes rho and kappa. Setbeam1dto the 1D beam profile of the band.kappa_rho: cleans kappa, and cuts the rho pixels that have a low kappa (cut_on,fraction).edge_mask: masks the map edges on kappa (10 arcmin).
After the preprocessors, each map is a rho/kappa map.
RhoKappaMapCoadder adds rho and kappa over the union of the input
footprints. Thus, in the coadd:
flux = rho / kappais the mean flux, with inverse-variance weights.snr = rho / sqrt(kappa).hitsis the sum of the input hits.time_meanis the mean, with hit weights, of the absolute unix times of the inputs. The coadder calculates it for each pixel.observation_startis the earliest start of the inputs.observation_endis the latest end.arrayis the list of the different input arrays, sorted and without spaces (for example,i1i3i4i6).
Set the fields to write with map_outputs[].fields. You can request each of
these fields: rho, kappa, flux, snr, hits and time_mean.
sotrp-coadd writes rho and kappa before finalize(), and flux and
snr after finalize().
The file names have the format {frequency}_{array}_{start}_{field}.fits,
for example f090_i1i3i4i6_1758171214_flux.fits. {start} is the unix time
of the start of the earliest input map. It is not the start of the window.
Each file with flux units records its unit in the FITS BUNIT header. The
matched filter uses mJy. Thus:
fluxhas the unitmJy.rhohas the unitmJy-1.kappahas the unitmJy-2.snr,hitsandtime_meanhave no flux unit.
When sotrplib reads a map from disk, it gets the flux unit from BUNIT. If
the file has no BUNIT, sotrplib uses the map_units value from the config.
If mapcat_registration.enabled is true, sotrp-coadd writes these rows in
mapcat:
depth_one_coadds: one row for the coadd. The row containscoadd_name,coadd_type,frequency,start_time,stop_time,ctimeand the file paths. The paths are relative toMAPCAT_DEPTH_ONE_COADD_PARENT:map_path(flux),rho_path,kappa_path(alsoivar_path) andmean_time_path.link_depth_one_map_to_coadd: one(map_id, coadd_id)row for each input map.time_domain_processing: acompletedstatus row for the coadd.
The depth_one_coadds table has no array column. Thus, a registered coadd
has a frequency but no array.
If enabled is false, sotrp-coadd writes the FITS files only.
For the processing status of the coadd and of the input maps, see Analyze coadds: processing status.
If a map causes an error in the build, the preprocessors or the merge:
sotrp-coaddrecords the error and the traceback in the log (stream_coadd.map_failed).- It does not put the map in the coadd.
- It continues with the next map.
At the end of the run, the sotrp_coadd.maps_excluded warning gives the
map_ids of these maps. If all maps fail, the run stops with an error, and
there is no coadd.
To find the maps to process again, compare the maps in the window with the
linked maps of the coadd (link_depth_one_map_to_coadd).