Commit b01c72c9 authored by Fang Yuedong's avatar Fang Yuedong
Browse files

Merge remote-tracking branch 'origin/develop' into develop

parents 7465f1d8 f4cf5529
This diff is collapsed.
No preview for this file type
......@@ -62,10 +62,10 @@ call_sequence:
hot_pixels: YES
dead_pixels: YES
bad_columns: YES
# Apply response nonlinearity
nonlinearity: {}
# Apply CCD Saturation & Blooming
blooming: {}
# Apply response nonlinearity
nonlinearity: {}
# Run CTE simulation
# CTE_effect: {}
# Add prescan and overscan
......
......@@ -154,13 +154,12 @@ class Observation(object):
chip_output.Log_error(e)
chip_output.Log_error("Failed simulation on step: %s" % (step))
break
chip_output.Log_info("check running:1: pointing-%d chip-%d pid-%d memory-%6.2fGB" % (pointing.id,
chip.chipID, os.getpid(), (psutil.Process(os.getpid()).memory_info().rss / 1024 / 1024 / 1024)))
del chip.img
del chip.flat_img
del chip.prnu_img
del chip.shutter_img
chip_output.Log_info("check running:1: pointing-%d chip-%d pid-%d memory-%6.2fGB" % (pointing.id,
chip.chipID, os.getpid(), (psutil.Process(os.getpid()).memory_info().rss / 1024 / 1024 / 1024)))
def runExposure_MPI_PointingList(self, pointing_list, chips=None):
comm = MPI.COMM_WORLD
......@@ -239,5 +238,6 @@ class Observation(object):
"finished running chip#%d..." % (chip.chipID))
for handler in chip_output.logger.handlers[:]:
chip_output.logger.removeHandler(handler)
del chip_output
gc.collect()
process_counter += nchips_per_fp
......@@ -37,7 +37,7 @@ void addEffects(int ngx_ima, int ngy_ima, float *arr_ima, float *arr_imc, int bi
{
printf("Adding BF effect...\n");
//setup BF correlation fliter
float neX;
float neX, neXtemp;
float neP1 = 50000;
float bfaP1[9]={0.9707182, 0.002143905, 0.004131103, 0.001149542, 0.0005501739, 0.0005469659, 0.0003726081, 0.0003795207, 0.0001633302};
float neP2 = 10000;
......@@ -56,15 +56,18 @@ void addEffects(int ngx_ima, int ngy_ima, float *arr_ima, float *arr_imc, int bi
neX = arr_ima[j+i*ny];
if(neX >= 10000)
{
neXtemp = neX;
if(neXtemp > 100000)
neXtemp = 100000;
bfa[0][0]=0; //linearInterp(neX, neP1, bfaP1[0], neP2, bfaP2[0]); //0;
bfa[0][1]=bfa[0][-1]=linearInterp(neX, neP1, bfaP1[1], neP2, bfaP2[1]); //0.01575;
bfa[-1][0]=bfa[1][0]=linearInterp(neX, neP1, bfaP1[2], neP2, bfaP2[2]); //0.00652;
bfa[-1][-1]=bfa[1][1]=bfa[-1][1]=bfa[1][-1]=linearInterp(neX, neP1, bfaP1[3], neP2, bfaP2[3]); //0.00335;
bfa[0][-2]=bfa[0][2]=linearInterp(neX, neP1, bfaP1[4], neP2, bfaP2[4]);
bfa[-2][0]=bfa[2][0]=linearInterp(neX, neP1, bfaP1[5], neP2, bfaP2[5]); //0.00118;
bfa[-2][-1]=bfa[-2][1]=bfa[2][1]=bfa[2][-1]=linearInterp(neX, neP1, bfaP1[6], neP2, bfaP2[6]);
bfa[-1][-2]=bfa[1][2]=bfa[-1][2]=bfa[1][-2]=linearInterp(neX, neP1, bfaP1[7], neP2, bfaP2[7]); //0.00083;
bfa[-2][-2]=bfa[-2][2]=bfa[2][-2]=bfa[2][2]=linearInterp(neX, neP1, bfaP1[8], neP2, bfaP2[8]); //0.00043;
bfa[0][1]=bfa[0][-1]=linearInterp(neXtemp, neP1, bfaP1[1], neP2, bfaP2[1]); //0.01575;
bfa[-1][0]=bfa[1][0]=linearInterp(neXtemp, neP1, bfaP1[2], neP2, bfaP2[2]); //0.00652;
bfa[-1][-1]=bfa[1][1]=bfa[-1][1]=bfa[1][-1]=linearInterp(neXtemp, neP1, bfaP1[3], neP2, bfaP2[3]); //0.00335;
bfa[0][-2]=bfa[0][2]=linearInterp(neXtemp, neP1, bfaP1[4], neP2, bfaP2[4]);
bfa[-2][0]=bfa[2][0]=linearInterp(neXtemp, neP1, bfaP1[5], neP2, bfaP2[5]); //0.00118;
bfa[-2][-1]=bfa[-2][1]=bfa[2][1]=bfa[2][-1]=linearInterp(neXtemp, neP1, bfaP1[6], neP2, bfaP2[6]);
bfa[-1][-2]=bfa[1][2]=bfa[-1][2]=bfa[1][-2]=linearInterp(neXtemp, neP1, bfaP1[7], neP2, bfaP2[7]); //0.00083;
bfa[-2][-2]=bfa[-2][2]=bfa[2][-2]=bfa[2][2]=linearInterp(neXtemp, neP1, bfaP1[8], neP2, bfaP2[8]); //0.00043;
}
else
{
......
......@@ -115,7 +115,7 @@ class Galaxy(MockObject):
# Set Galsim Parameters
if self.getMagFilter(filt) <= 15 and (not big_galaxy):
folding_threshold = 5.e-4
folding_threshold = 5.e-8
else:
folding_threshold = 5.e-3
gsp = galsim.GSParams(folding_threshold=folding_threshold)
......@@ -170,8 +170,11 @@ class Galaxy(MockObject):
# print("nphotons_sub-band_%d = %.2f"%(i, nphotons))
# Get PSF model
EXTRA = False
if self.getMagFilter(filt) <= filt.mag_saturation-1.:
EXTRA = True
psf, pos_shear = psf_model.get_PSF(
chip=chip, pos_img=pos_img, bandpass=bandpass, folding_threshold=folding_threshold)
chip=chip, pos_img=pos_img, bandpass=bandpass, folding_threshold=folding_threshold, extrapolate=EXTRA)
if self.bfrac == 0:
gal_temp = disk
......@@ -198,7 +201,7 @@ class Galaxy(MockObject):
# gal = self.bfrac * bulge + (1.0 - self.bfrac - kfrac) * disk + kfrac * knots
# stamp = gal.drawImage(wcs=chip_wcs_local, method='phot', offset=offset, save_photons=True)
stamp = gal.drawImage(wcs=chip_wcs_local, offset=offset)
stamp = gal.drawImage(method='no_pixel', wcs=chip_wcs_local, offset=offset)
if np.sum(np.isnan(stamp.array)) > 0:
# ERROR happens
return 2, pos_shear
......
......@@ -122,7 +122,7 @@ class MockObject(object):
return 2, None
# Set Galsim Parameters
if self.getMagFilter(filt) <= 15:
folding_threshold = 5.e-4
folding_threshold = 5.e-8
else:
folding_threshold = 5.e-3
gsp = galsim.GSParams(folding_threshold=folding_threshold)
......@@ -160,14 +160,17 @@ class MockObject(object):
# print("nphotons_sub-band_%d = %.2f"%(i, nphotons))
# Get PSF model
EXTRA = False
if self.getMagFilter(filt) <= filt.mag_saturation-1.:
EXTRA = True
psf, pos_shear = psf_model.get_PSF(chip=chip, pos_img=pos_img, bandpass=bandpass,
folding_threshold=folding_threshold)
folding_threshold=folding_threshold, extrapolate=EXTRA)
# star = galsim.DeltaFunction(gsparams=gsp)
# star = star.withFlux(nphotons)
# star = galsim.Convolve(psf, star)
star = psf.withFlux(nphotons)
stamp = star.drawImage(wcs=chip_wcs_local, offset=offset)
stamp = star.drawImage(method='no_pixel', wcs=chip_wcs_local, offset=offset)
if np.sum(np.isnan(stamp.array)) > 0:
continue
stamp.setCenter(x_nominal, y_nominal)
......
......@@ -92,7 +92,7 @@ class Stamp(MockObject):
else:
gal = gal + gal_temp
stamp = gal.drawImage(wcs=chip_wcs_local, offset=offset)
stamp = gal.drawImage(method='no_pixel', wcs=chip_wcs_local, offset=offset)
if np.sum(np.isnan(stamp.array)) > 0:
# ERROR happens
return 2, pos_shear
......
......@@ -13,6 +13,7 @@ import galsim
import h5py
from observation_sim.psf.PSFModel import PSFModel
from observation_sim.psf._util import psf_extrapolate
NPSF = 900 # ***# 30*30
......@@ -324,7 +325,7 @@ class PSFInterp(PSFModel):
return twave
return -1
def get_PSF(self, chip, pos_img, bandpass, galsimGSObject=True, findNeighMode='treeFind', folding_threshold=5.e-3, pointing_pa=0.0):
def get_PSF(self, chip, pos_img, bandpass, galsimGSObject=True, findNeighMode='treeFind', folding_threshold=5.e-3, pointing_pa=0.0, extrapolate=False, ngg=2048):
"""
Get the PSF at a given image position
......@@ -358,20 +359,18 @@ class PSFInterp(PSFModel):
imPSF = psfMaker_IDW(px, py, PSFMat, cen_col, cen_row, IDWindex=2, OnlyNeighbors=True,
hoc=self.hoc[twave], hoclist=self.hoclist[twave], PSFCentroidWgt=True)
'''
############TEST: START
TestGaussian = False
if TestGaussian:
gsx = galsim.Gaussian(sigma=0.04)
#pointing_pa = -23.433333
imPSF= gsx.shear(g1=0.8, g2=0.).rotate(0.*galsim.degrees).drawImage(nx = 256, ny=256, scale=pixSize).array
############TEST: END
'''
if extrapolate is True:
ccdList = [6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25]
rr_trim_list = [72, 64, 96, 88, 64, 72, 72, 76, 72, 72, 76, 72, 72, 64, 88, 96, 64, 72]
imPSF = psf_extrapolate(imPSF, rr_trim=rr_trim_list[ccdList.index(chip.chipID)], ngg=ngg)
if galsimGSObject:
imPSFt = np.zeros([257, 257])
imPSFt[0:256, 0:256] = imPSF
# imPSFt[120:130, 0:256] = 1.
if extrapolate is True:
imPSFt = np.zeros([ngg+1, ngg+1])
imPSFt[:-1, :-1] = imPSF
else:
imPSFt = np.zeros([257, 257])
imPSFt[0:256, 0:256] = imPSF
img = galsim.ImageF(imPSFt, scale=pixSize)
gsp = galsim.GSParams(folding_threshold=folding_threshold)
......
import numpy as np
from scipy.interpolate import interp1d
def binningPSF(img, ngg):
imgX = img.reshape(ngg, img.shape[0]//ngg, ngg, img.shape[1]//ngg).mean(-1).mean(1)
return imgX
def radial_average_at_pixel(image, center_x, center_y, dr=10):
# Get coordinates relative to the specified center pixel (x, y)
y, x = np.indices(image.shape)
r = np.sqrt((x - center_x)**2 + (y - center_y)**2)
# Set up bins
max_radius = int(r.max()) # Maximum distance from the center pixel
radial_bins = np.arange(0, max_radius, dr)
# Compute average value in each bin
radial_means = []
for i in range(len(radial_bins) - 1):
mask = (r >= radial_bins[i]) & (r < radial_bins[i + 1])
if np.any(mask):
radial_means.append(image[mask].mean())
else:
radial_means.append(0) # In case no pixels are in the bin
return radial_bins[:-1], radial_means # Exclude last bin since no mean calculated
def psf_extrapolate(psf, rr_trim=64, ngg=256):
# ngg = 256
# extrapolate PSF
if True:
xim = np.arange(256)-128
xim, yim = np.meshgrid(xim, xim)
rim = np.sqrt(xim**2 + yim**2)
# rr_trim = 96
psf_temp = psf
psf_temp[rim > rr_trim] = 0
radii, means = radial_average_at_pixel(psf_temp, 128, 128, dr=4)
radii_log = np.log(radii[1:])
means_log = np.log(means[1:])
finite_mask = np.isfinite(means_log)
f_interp = interp1d(radii_log[finite_mask][:-1], means_log[finite_mask][:-1], kind='linear', fill_value="extrapolate")
# ngg = 1024
xim = np.arange(ngg)-int(ngg/2)
xim, yim = np.meshgrid(xim, xim)
rim = np.sqrt(xim**2 + yim**2)
rim[int(ngg/2), int(ngg/2)] = np.finfo(float).eps # 1e-7
rim_log = np.log(rim)
y_new = f_interp(rim_log)
arr = np.zeros([ngg, ngg])
arr[int(ngg/2-128):int(ngg/2+128), int(ngg/2-128):int(ngg/2+128)] = np.log(psf_temp + np.finfo(float).eps)
arr[rim > rr_trim] = 0
arr[arr == 0] = y_new[arr == 0]
psf = np.exp(arr)
psf[rim > int(ngg/2)] = 0
imPSF = psf # binningPSF(psf, int(ngg/2))
imPSF = imPSF/np.nansum(imPSF)
return imPSF
......@@ -238,11 +238,12 @@ def add_objects(self, chip, filt, tel, pointing, catalog, obs_param):
self.chip_output.Log_error("obj id: %s" % (obj.param['id']))
self.chip_output.Log_error(" e1: %.5f\n e2: %.5f\n size: %f\n bfrac: %f\n detA: %f\n g1: %.5f\n g2: %.5f\n" % (
obj.param['e1'], obj.param['e2'], obj.param['size'], obj.param['bfrac'], obj.param['detA'], obj.param['g1'], obj.param['g2']))
# Unload SED:
obj.unload_SED()
del obj
# gc.collect()
cat.starDDL.freeGlobeData()
del cat.starDDL
if chip.survey_type == "spectroscopic" and not self.overall_config["run_option"]["out_cat_only"] and chip.slsPSFOptim:
# from observation_sim.instruments.chip import chip_utils as chip_utils
......
from flask import Flask, render_template, request, redirect
import yaml
import ast
app = Flask(__name__)
key_type_map = {
'obs_type': str,
'obs_type_code': str,
'obs_id': str,
'run_chips': list,
'call_sequence': {
'scie_obs': {
'shutter_effect': bool,
'flat_fielding': bool,
'field_dist': bool,
},
'sky_background': {
'shutter_effect': bool,
'flat_fielding': bool,
'enable_straylight_model': bool,
'flat_level': None,
'flat_level_filt': None,
},
'PRNU_effect': {},
'cosmic_rays': {
'save_cosmic_img': bool,
},
'poisson_and_dark': {
'add_dark': bool,
},
'bright_fatter': {},
'detector_defects': {
'hot_pixels': bool,
'dead_pixels': bool,
'bad_columns': bool,
},
'nonlinearity': {},
'blooming': {},
'prescan_overscan': {
'add_dark': bool,
},
'bias': {
'bias_16channel': bool,
},
'readout_noise': {},
'gain': {
'gain_16channel': bool,
},
'quantization_and_output': {
'format_output': bool,
},
},
}
def convert_dict_values(d, key_type_map):
for key, value in d.items():
if isinstance(value, dict):
convert_dict_values(value, key_type_map[key])
elif key in key_type_map:
if key_type_map[key] is int:
d[key] = int(value)
if key_type_map[key] is float:
d[key] = float(value)
if key_type_map[key] is bool:
if d[key].lower() == 'yes' or d[key].lower() == 'true':
d[key] = True
else:
d[key] = False
if key_type_map[key] is str:
d[key] = str(value)
if key_type_map[key] is list:
d[key] = ast.literal_eval(value)
if key_type_map[key] is None:
d[key] = None
def load_yaml():
with open('templates/obs_config_SCI.yaml', 'r') as file:
return yaml.safe_load(file)
def save_yaml(data):
convert_dict_values(data, key_type_map)
with open('config_reset/obs_config_SCI_reset.yaml', 'w') as file:
yaml.dump(data, file, default_flow_style=False, sort_keys=False)
def render_form(data, parent_key=''):
form_html = ''
for key, value in data.items():
full_key = f"{parent_key}.{key}" if parent_key else key
if isinstance(value, dict): # 处理字典
form_html += f"<div class='block'><h2>{key}</h2>{render_form(value, full_key)}</div>"
else:
form_html += f"<label for='{full_key}'>{key}:</label>"
form_html += f"<input type='text' id='{full_key}' name='{full_key}' value='{value}'><br>"
return form_html
@app.route('/', methods=['GET', 'POST'])
def index():
if request.method == 'POST':
data = load_yaml()
for key in request.form:
keys = key.split('.')
temp = data
for k in keys[:-1]:
temp = temp[k]
temp[keys[-1]] = request.form[key]
save_yaml(data)
return redirect('/')
data = load_yaml()
form_html = render_form(data)
return render_template('index_obs.html', form_html=form_html)
if __name__ == '__main__':
app.run(debug=True)
from flask import Flask, render_template, request, redirect
import yaml
import ast
app = Flask(__name__)
key_type_map = {
'work_dir': str,
'run_name': str,
'project_cycle': int,
'run_counter': int,
'run_option': {
'out_cat_only': bool,
},
'catalog_options': {
'input_path': {
'cat_dir': str,
'star_cat': str,
'galaxy_cat': str,
},
'SED_templates_path': {
'star_SED': str,
'galaxy_SED': str,
'AGN_SED': str,
},
'star_only': bool,
'galaxy_only': bool,
'rotateEll': float,
'enable_mw_ext_gal': bool,
'planck_ebv_map': str,
},
'obs_setting': {
'pointing_file': str,
'obs_config_file': str,
'run_pointings': list,
'enable_astrometric_model': bool,
'cut_in_band': str,
'mag_sat_margin': float,
'mag_lim_margin': float,
},
'psf_setting': {
'psf_model': str,
'psf_pho_dir': str,
'psf_sls_dir': str,
},
'shear_setting': {
'shear_type': str,
'reduced_g1': float,
'reduced_g2': float,
},
'output_setting': {
'output_format': str,
'shutter_output': bool,
'prnu_output': bool,
},
'random_seeds': {
'seed_poisson': int,
'seed_CR': int,
'seed_flat': int,
'seed_prnu': int,
'seed_gainNonUniform': int,
'seed_biasNonUniform': int,
'seed_rnNonUniform': int,
'seed_badcolumns': int,
'seed_defective': int,
'seed_readout': int,
},
}
def convert_dict_values(d, key_type_map):
for key, value in d.items():
if isinstance(value, dict):
convert_dict_values(value, key_type_map[key])
elif key in key_type_map:
if key_type_map[key] is int:
d[key] = int(value)
if key_type_map[key] is float:
d[key] = float(value)
if key_type_map[key] is bool:
if d[key].lower() == 'yes' or d[key].lower() == 'true':
d[key] = True
else:
d[key] = False
if key_type_map[key] is str:
d[key] = str(value)
if key_type_map[key] is list:
d[key] = ast.literal_eval(value)
def load_yaml():
with open('templates/config_overall.yaml', 'r') as file:
return yaml.safe_load(file)
def save_yaml(data):
convert_dict_values(data, key_type_map)
with open('config_reset/config_overall_reset.yaml', 'w') as file:
yaml.dump(data, file, default_flow_style=False, sort_keys=False)
def render_form(data, parent_key=''):
form_html = ''
for key, value in data.items():
full_key = f"{parent_key}.{key}" if parent_key else key
if isinstance(value, dict): # 处理字典
form_html += f"<div class='block'><h2>{key}</h2>{render_form(value, full_key)}</div>"
else:
form_html += f"<label for='{full_key}'>{key}:</label>"
form_html += f"<input type='text' id='{full_key}' name='{full_key}' value='{value}'><br>"
return form_html
@app.route('/', methods=['GET', 'POST'])
def index():
if request.method == 'POST':
data = load_yaml()
for key in request.form:
keys = key.split('.')
temp = data
for k in keys[:-1]:
temp = temp[k]
temp[keys[-1]] = request.form[key]
save_yaml(data)
return redirect('/')
data = load_yaml()
form_html = render_form(data)
return render_template('index_overall.html', form_html=form_html)
if __name__ == '__main__':
app.run(debug=True)
---
###############################################
#
# Configuration file for CSST simulation
# Overall settings
# CSST-Sim Group, 2024/01/08
#
###############################################
# Base diretories and naming setup
# can add some of the command-line arguments here as well;
# ok to pass either way or both, as long as they are consistent
work_dir: "/public/home/fangyuedong/project/workplace/"
run_name: "ext_on"
# Project cycle and run counter are used to name the outputs
project_cycle: 9
run_counter: 1
# Run options
run_option:
# Output catalog only?
# If yes, no imaging simulation will be run. Only the catalogs
# of corresponding footprints will be generated.
out_cat_only: NO
###############################################
# Catalog setting
###############################################
# Configure the input catalog: options should be implemented
# in the corresponding (user defined) 'Catalog' class
catalog_options:
input_path:
cat_dir: "/public/share/yangxuliu/CSSOSDataProductsSims/data_50sqDeg/"
star_cat: "starcat_C9/"
galaxy_cat: "qsocat/cat2CSSTSim_bundle-50sqDeg/"
SED_templates_path:
star_SED: "/public/share/yangxuliu/CSSOSDataProductsSims/data_50sqDeg/starcat_C9/"
galaxy_SED: "/public/share/yangxuliu/CSSOSDataProductsSims/data_50sqDeg/sedlibs/"
AGN_SED: "/public/share/yangxuliu/CSSOSDataProductsSims/data_50sqDeg/qsocat/qsosed/"
# Only simulate stars?
star_only: NO
# Only simulate galaxies?
galaxy_only: NO
# rotate galaxy ellipticity
rotateEll: 0. # [degree]
# Whether to apply milky way extinction to galaxies
enable_mw_ext_gal: YES
planck_ebv_map: "/public/home/fangyuedong/project/ext_maps/planck/HFI_CompMap_ThermalDustModel_2048_R1.20.fits"
###############################################
# Observation setting
###############################################
obs_setting:
# (Optional) a file of point list
# if you just want to run default pointing:
# - pointing_dir: null
# - pointing_file: null
pointing_file: "/public/share/yangxuliu/CSSOSDataProductsSims/data_50sqDeg/pointing50_C9/pointing_50_1_n.dat"
obs_config_file: "/public/home/fangyuedong/project/csst_msc_sim/config/obs_config_SCI.yaml"
# Run specific pointing(s):
# - give a list of indexes of pointings: [ip_1, ip_2...]
# - run all pointings: null
# Note: only valid when a pointing list is specified
run_pointings: [0, 1, 2, 3, 4]
# Whether to enable astrometric modeling
enable_astrometric_model: YES
# Cut by saturation magnitude in which band?
cut_in_band: "z"
# saturation magnitude margin
mag_sat_margin: -2.5
# mag_sat_margin: -15.
# limiting magnitude margin
mag_lim_margin: +1.0
###############################################
# PSF setting
###############################################
psf_setting:
# Which PSF model to use:
# "Gauss": simple gaussian profile
# "Interp": Interpolated PSF from sampled ray-tracing data
psf_model: "Interp"
# PSF size [arcseconds]
# radius of 80% energy encircled
# NOTE: only valid for "Gauss" PSF
# psf_rcont: 0.15
# path to PSF data
# NOTE: only valid for "Interp" PSF
# PSF models for photometry survey simulation
psf_pho_dir: "/public/share/yangxuliu/CSSOSDataProductsSims/dataC6/psfCube1"
# PSF models for slitless spectrum survey simulation
psf_sls_dir: "/public/share/yangxuliu/CSSOSDataProductsSims/data_50sqDeg/SLS_PSF_PCA_fp/"
###############################################
# Shear setting
###############################################
shear_setting:
# Options to generate mock shear field:
# "constant": all galaxies are assigned a constant reduced shear
# "catalog": get shear values from catalog
shear_type: "constant"
# For constant shear field
reduced_g1: 0.
reduced_g2: 0.
###############################################
# Output options
###############################################
output_setting:
output_format: "channels" # Whether to export as 16 channels (subimages) with pre- and over-scan ("image"/"channels")
shutter_output: NO # Whether to export shutter effect 16-bit image
prnu_output: NO # Whether to export the PRNU (pixel-to-pixel flat-fielding) files
###############################################
# Random seeds
###############################################
random_seeds:
seed_poisson: 20210601 # Seed for Poisson noise
seed_CR: 20210317 # Seed for generating random cosmic ray maps
seed_flat: 20210101 # Seed for generating random flat fields
seed_prnu: 20210102 # Seed for photo-response non-uniformity
seed_gainNonUniform: 20210202 # Seed for gain nonuniformity
seed_biasNonUniform: 20210203 # Seed for bias nonuniformity
seed_rnNonUniform: 20210204 # Seed for readout-noise nonuniformity
seed_badcolumns: 20240309 # Seed for bad columns
seed_defective: 20210304 # Seed for defective (bad) pixels
seed_readout: 20210601 # Seed for read-out gaussian noise
...
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>csst_msc_sim_CONF</title>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" rel="stylesheet">
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 20px;
background-color: #f4f4f4;
color: #333;
}
h1 {
text-align: center;
color: #4CAF50;
}
.container {
max-width: 800px;
margin: 0 auto;
background: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
.block {
margin-bottom: 20px;
border: 1px solid #ccc;
border-radius: 4px;
padding: 10px;
background-color: #fafafa;
}
h2 {
color: #4CAF50;
font-size: 1.2em;
margin-bottom: 10px;
}
label {
display: block;
margin: 5px 0;
}
input[type="text"] {
width: calc(100% - 22px);
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
margin-bottom: 10px;
transition: border 0.3s;
}
input[type="text"]:focus {
border-color: #4CAF50;
outline: none;
}
input[type="submit"] {
background-color: #4CAF50;
color: white;
border: none;
padding: 10px 15px;
border-radius: 4px;
cursor: pointer;
font-size: 1em;
transition: background-color 0.3s;
}
input[type="submit"]:hover {
background-color: #45a049;
}
table {
width: 100%;
border: 1px solid #ddd;
border-radius: 8px; /* 圆角 */
overflow: hidden; /* 隐藏超出表格的内容 */
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); /* 添加阴影 */
}
th, td {
border-bottom: 1px solid #ddd; /* 单元格底部边框 */
padding: 12px; /* 内边距 */
text-align: left;
}
tr:hover {
background-color: #ADD8E6; /* 悬停时背景颜色 */
}
</style>
</head>
<body>
<div class="container">
<h1>配置obs_config_SCI.yaml</h1>
<p><strong>说明:</strong>
1,该脚本可用于生成CSST主巡天成像仿真的参数文件,相关参数说明见本页脚注;2,用户必须修改相关路径参数,其他参数可参考默认值
.
</p>
<hr style="border: 2px solid green;">
<form method="POST">
{{ form_html | safe }}
<input type="submit" value="保存">
</form>
</div>
<footer class="mt-4">
<p class="text-center">这是一个有用的网页</p>
<table>
<tr>
<th>KEYS</th>
<th>VALUES</th>
<th>COMMENTS</th>
</tr>
<tr>
<th>obs_type</th>
<td>"SCI", [str]</td>
<td>仿真图像类型</td>
</tr>
<tr>
<th>obs_type_code</th>
<td>"101", [str]</td>
<td>数据系统内部标号</td>
</tr>
<tr>
<th>obs_id</th>
<td>"00000001", [str]</td>
<td>this setting will only be used if pointing list file is not given</td>
</tr>
<tr>
<th>run_chips</th>
<td>[7,8,9], [list]</td>
<td>Define list of chips</td>
</tr>
<tr>
<th>scie_obs:<span style="font-weight: normal;">shutter_effect</span></th>
<td>YES, [bool]</td>
<td>是否应用快门效应</td>
</tr>
<tr>
<th>scie_obs:<span style="font-weight: normal;">flat_fielding</span></th>
<td>YES, [bool]</td>
<td>是否应用平场模块</td>
</tr>
<tr>
<th>scie_obs:<span style="font-weight: normal;">field_dist</span></th>
<td>YES, [bool]</td>
<td> </td>
</tr>
<tr>
<th>sky_background:<span style="font-weight: normal;">shutter_effect</span></th>
<td>YES, [bool]</td>
<td>是否应用快门效应</td>
</tr>
<tr>
<th>sky_background:<span style="font-weight: normal;">flat_fielding</span></th>
<td>YES, [bool]</td>
<td>是否应用平场模块</td>
</tr>
<tr>
<th>sky_background:<span style="font-weight: normal;">enable_straylight_model</span></th>
<td>YES, [bool]</td>
<td>是否应用杂散光模块</td>
</tr>
<tr>
<th>sky_background:<span style="font-weight: normal;">flat_level</span></th>
<td>null [null or int]</td>
<td>set the total skybackground value (e-) in the exptime,if none,set null, or delete the key</td>
</tr>
<tr>
<th>sky_background:<span style="font-weight: normal;">flat_level_filt</span></th>
<td>null, [str]</td>
<td>the vale of "flat_level" is in the filter "flat_level_filt", can set NUV, u, g, r, i, z, y, if none,set null,or delete the key</td>
</tr>
<tr>
<th>PRNU_effect<span style="font-weight: normal;"></span></th>
<td>---</td>
<td>应用像素间不均匀响应模块;如果需关闭,请在生成的yaml文件中直接注释</td>
</tr>
<tr>
<th>cosmic_rays:<span style="font-weight: normal;">save_cosmic_img</span></th>
<td>YES, [bool]</td>
<td>是否保存宇宙线图像</td>
</tr>
<tr>
<th>poisson_and_dark:<span style="font-weight: normal;">add_dark</span></th>
<td>YES, [bool]</td>
<td>是否添加暗电流</td>
</tr>
<tr>
<th>bright_fatter<span style="font-weight: normal;"></span></th>
<td>YES, [bool]</td>
<td>应用亮胖效应模块;如果需关闭,请在生成的yaml文件中直接注释</td>
</tr>
<tr>
<th>detector_defects:<span style="font-weight: normal;">hot_pixels</span></th>
<td>YES, [bool]</td>
<td>是否添加热像元</td>
</tr>
<tr>
<th>detector_defects:<span style="font-weight: normal;">dead_pixels</span></th>
<td>YES, [bool]</td>
<td>是否添加坏像元</td>
</tr>
<tr>
<th>detector_defects:<span style="font-weight: normal;">bad_columns</span></th>
<td>YES, [bool]</td>
<td>是否添加坏像列</td>
</tr>
<tr>
<th>nonlinearity<span style="font-weight: normal;"></span></th>
<td>---</td>
<td>应用非线性响应模块;如果需关闭,请在生成的yaml文件中直接注释</td>
</tr>
<tr>
<th>blooming<span style="font-weight: normal;"></span></th>
<td>---</td>
<td>是否应用饱和溢出模块;如果需关闭,请在生成的yaml文件中直接注释</td>
</tr>
<tr>
<th>prescan_overscan:<span style="font-weight: normal;">add_dark</span></th>
<td>YES, [bool]</td>
<td> 是否在pre/over-scan区域添加暗电流/</td>
</tr>
<tr>
<th>bias:<span style="font-weight: normal;">bias_16channel</span></th>
<td>YES, [bool]</td>
<td>是否添加16通道的偏置电压</td>
</tr>
<tr>
<th>readout_noise<span style="font-weight: normal;"></span></th>
<td>---</td>
<td>添加读出噪声;如果需关闭,请在生成的yaml文件中直接注释</td>
</tr>
<tr>
<th>gain:<span style="font-weight: normal;">gain_16channel</span></th>
<td>YES, [bool]</td>
<td>是否应用增益</td>
</tr>
<tr>
<th>quantization_and_output:<span style="font-weight: normal;">format_output</span></th>
<td>YES, [bool]</td>
<td>是否按0级数据格式定义输出图像</td>
</tr>
</table>
</footer>
</body>
</html>
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>csst_msc_sim_CONF</title>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" rel="stylesheet">
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 20px;
background-color: #f4f4f4;
color: #333;
}
h1 {
text-align: center;
color: #4CAF50;
}
.container {
max-width: 800px;
margin: 0 auto;
background: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
.block {
margin-bottom: 20px;
border: 1px solid #ccc;
border-radius: 4px;
padding: 10px;
background-color: #fafafa;
}
h2 {
color: #4CAF50;
font-size: 1.2em;
margin-bottom: 10px;
}
label {
display: block;
margin: 5px 0;
}
input[type="text"] {
width: calc(100% - 22px);
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
margin-bottom: 10px;
transition: border 0.3s;
}
input[type="text"]:focus {
border-color: #4CAF50;
outline: none;
}
input[type="submit"] {
background-color: #4CAF50;
color: white;
border: none;
padding: 10px 15px;
border-radius: 4px;
cursor: pointer;
font-size: 1em;
transition: background-color 0.3s;
}
input[type="submit"]:hover {
background-color: #45a049;
}
table {
width: 100%;
border: 1px solid #ddd;
border-radius: 8px; /* 圆角 */
overflow: hidden; /* 隐藏超出表格的内容 */
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); /* 添加阴影 */
}
th, td {
border-bottom: 1px solid #ddd; /* 单元格底部边框 */
padding: 12px; /* 内边距 */
text-align: left;
}
tr:hover {
background-color: #ADD8E6; /* 悬停时背景颜色 */
}
</style>
</head>
<body>
<div class="container">
<h1>配置config_overall.yaml</h1>
<p><strong>说明:</strong>
1,该脚本可用于生成CSST主巡天成像仿真的参数文件,相关参数说明见本页脚注;2,用户必须修改相关路径参数,其他参数可参考默认值.
</p>
<hr style="border: 2px solid green;">
<form method="POST">
{{ form_html | safe }}
<input type="submit" value="保存">
</form>
</div>
<footer class="mt-4">
<p class="text-center">这是一个有用的网页</p>
<table>
<tr>
<th>KEYS</th>
<th>VALUES</th>
<th>COMMENTS</th>
</tr>
<tr>
<th>work_dir</th>
<td>/localpath, [str]</td>
<td>工作目录-仿真输出的文件路径</td>
</tr>
<tr>
<th>run_name</th>
<td>testRun, [str]</td>
<td>当前仿真目录</td>
</tr>
<tr>
<th>project_cycle</th>
<td>10, [int]</td>
<td>CSST数据系统开发阶段-C10</td>
</tr>
<tr>
<th>project_cycle</th>
<td>0, [int]</td>
<td>仿真次数标号-0</td>
</tr>
<tr>
<th>run_option:<span style="font-weight: normal;">out_cat_only</span></th>
<td>NO, [bool]</td>
<td>是否仅输出星表-YES,不产生开展成像仿真,直接输出星表文件;NO,开展成像仿真</td>
</tr>
<tr>
<th>catalog_options:<span style="font-weight: normal;">input_path</span></th>
<td>/localpath, [str]</td>
<td>"cat_dir": 输入星表路径, "star_cat": 恒星星表目录, "galaxy_cat": 星系星表目录</td>
</tr>
<tr>
<th>catalog_options:<span style="font-weight: normal;">SED_templates_path</span></th>
<td>/localpath, [str]</td>
<td>"star_SED": 恒星SED路径,"galaxy_SED": 星系SED路径,"AGN_SED": 类星体SED路径</td>
</tr>
<tr>
<th>catalog_options:<span style="font-weight: normal;">star_only</span></th>
<td>NO, [bool]</td>
<td>YES,只对恒星成像;NO,包含其他天体成像</td>
</tr>
<tr>
<th>catalog_options:<span style="font-weight: normal;">galaxy_only</span></th>
<td>NO, [bool]</td>
<td>YES,只对星系成像;NO,包含其他天体成像</td>
</tr>
<tr>
<th>catalog_options:<span style="font-weight: normal;">rotateEll</span></th>
<td>0.0, [float]</td>
<td>旋转星系指向(度)</td>
</tr>
<tr>
<th>catalog_options:<span style="font-weight: normal;">enable_mw_ext_gal</span></th>
<td>NO, [bool]</td>
<td>是否应用银河系消光</td>
</tr>
<tr>
<th>catalog_options:<span style="font-weight: normal;">planck_ebv_map</span></th>
<td>/localpath, [str]</td>
<td>消光模型</td>
</tr>
<tr>
<th>obs_setting:<span style="font-weight: normal;">pointing_file</span></th>
<td>/localpath, [str]</td>
<td>曝光指向文件路径</td>
</tr>
<tr>
<th>obs_setting:<span style="font-weight: normal;">obs_config_file</span></th>
<td>/localpath, [str]</td>
<td>观测配置文件路径</td>
</tr>
<tr>
<th>obs_setting:<span style="font-weight: normal;">run_pointings</span></th>
<td>[0], [int]</td>
<td>give a list of indexes of pointings</td>
</tr>
<tr>
<th>obs_setting:<span style="font-weight: normal;">enable_astrometric_model</span></th>
<td>YES, [bool]</td>
<td>是否应用天测模块</td>
</tr>
<tr>
<th>obs_setting:<span style="font-weight: normal;">cut_in_band</span></th>
<td>"z", [str]</td>
<td>Cut by saturation magnitude in which band</td>
</tr>
<tr>
<th>obs_setting:<span style="font-weight: normal;">mag_sat_margin</span></th>
<td>-2.5, [float]</td>
<td>saturation magnitude margin</td>
</tr>
<tr>
<th>obs_setting:<span style="font-weight: normal;">mag_lim_margin</span></th>
<td>+1.0, [float]</td>
<td>limiting magnitude margin</td>
</tr>
<tr>
<th>psf_setting:<span style="font-weight: normal;">psf_model</span></th>
<td>"Interp", [str]</td>
<td>Interp-Interpolated PSF from sampled ray-tracing data; Gauss-simple gaussian profile</td>
</tr>
<tr>
<th>psf_setting:<span style="font-weight: normal;">psf_pho_dir</span></th>
<td>/localpath, [str]</td>
<td>多色成像PSF数据库路径</td>
</tr>
<tr>
<th>psf_setting:<span style="font-weight: normal;">psf_sls_dir</span></th>
<td>/localpath, [str]</td>
<td>无缝光谱PSF数据库路径</td>
</tr>
<tr>
<th>shear_setting:<span style="font-weight: normal;">shear_type</span></th>
<td>constant, [str]</td>
<td>constant-all galaxies are assigned a constant reduced shear; catalog-get shear values from catalog</td>
</tr>
<tr>
<th>shear_setting:<span style="font-weight: normal;">reduced_g1</span></th>
<td>0.0, [float]</td>
<td>weak lensing shear, gamma_1</td>
</tr>
<tr>
<th>shear_setting:<span style="font-weight: normal;"></span>reduced_g1</th>
<td>0.0, [float]</td>
<td>weak lensing shear, gamma_2</td>
</tr>
<tr>
<th>output_setting:<span style="font-weight: normal;">output_format</span></th>
<td>channels, [str]</td>
<td>Whether to export as 16 channels (subimages) with pre- and over-scan (\"image\"/\"channels\")</td>
</tr>
<tr>
<th>output_setting:<span style="font-weight: normal;">shutter_output</span></th>
<td>NO, [bool]</td>
<td>Whether to export shutter effect 16-bit image</td>
</tr>
<tr>
<th>output_setting:<span style="font-weight: normal;">prnu_output</span></th>
<td>NO, [bool]</td>
<td>Whether to export the PRNU (pixel-to-pixel flat-fielding) files</td>
</tr>
<tr>
<th>random_seeds</th>
<td>[int]</td>
<td>设置随机数种子</td>
</tr>
</table>
</footer>
</body>
</html>
---
###############################################
#
# Configuration file for CSST simulation
# For single exposure type:
# SCI-WIDE
# CSST-Sim Group, 2024/01/08
#
###############################################
# Observation type
obs_type: "SCI"
obs_type_code: "101"
obs_id: "00000001" # this setting will only be used if pointing list file is not given
# Define list of chips
# run_chips: [6,7,8,9,11,12,13,14,15,16,17,18,19,20,22,23,24,25] # Photometric chips
#run_chips: [1,2,3,4,5,10,21,26,27,28,29,30] # Spectroscopic chips
run_chips: [17, 22]
# Define observation sequence
call_sequence:
# Accumulate fluxes from objects
scie_obs:
# [Optional]: exposure time of the pointing will be used as default.
# Set it here is you want to override the default
# exptime: 150. # [s]
shutter_effect: YES
flat_fielding: YES
field_dist: YES
# Accumulate fluxes from sky background
sky_background:
# [Optional]: exposure time of the pointing will be used as default.
# Set it here is you want to override the default
# exptime: 150. # [s]
shutter_effect: YES
flat_fielding: YES
enable_straylight_model: YES
# flat_level: set the total skybackground value (e-) in the exptime,if none,set null, or delete the key
# flat_level_filt: the vale of "flat_level" is in the filter "flat_level_filt", can set NUV, u, g, r, i, z, y, if
# none,set null,or delete the key
flat_level: null
flat_level_filt: null
# Apply PRNU to accumulated photons
PRNU_effect: {}
# Accumulate photons caused by cosmic rays
cosmic_rays:
# [Optional]: exposure time of the pointing will be used as default.
# Set it here is you want to override the default
# exptime: 150. # [s]
save_cosmic_img: YES # # Whether to export cosmic ray image
# Add Poission noise and dark current
poisson_and_dark:
# [Optional]: exposure time of the pointing will be used as default.
# Set it here is you want to override the default
# exptime: 150. # [s]
add_dark: YES
# Simulate brighter fatter effects
bright_fatter: {}
# Add detector defects: hot/warm pixels, bad columns
detector_defects:
hot_pixels: YES
dead_pixels: YES
bad_columns: YES
# Apply response nonlinearity
nonlinearity: {}
# Apply CCD Saturation & Blooming
blooming: {}
# Run CTE simulation
# CTE_effect: {}
# Add prescan and overscan
prescan_overscan:
add_dark: YES
# Add bias
bias:
bias_16channel: YES
# Add readout noise
readout_noise: {}
# Apply gain
gain:
gain_16channel: YES
# Output the final image
quantization_and_output:
format_output: YES
...
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment