Skip to content

Commit 027c7c9

Browse files
committed
Improved IGM absorption
1 parent 400f5ae commit 027c7c9

File tree

4 files changed

+75
-4
lines changed

4 files changed

+75
-4
lines changed

CHANGELOG

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
v1.1.0
2+
======
3+
4+
New/updated feature:
5+
- Improved the treatment of IGM absorption. Now the absorption is computed on a per-galaxy basis, based on the redshift. Before that, the IGM absorption was quite poorly implemented, as a single value of the absorption for the entire catalog with no redshift dependence. The old behavior of the code can be recovered by setting the "naive_igm" flag on the command line.
6+
7+
18
v1.0.9
29
======
310

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ find_package(phypp)
1212
set(EGG_SHARE_DIR ${CMAKE_INSTALL_PREFIX}/share/egg)
1313
install(FILES
1414
share/ir_lib_ce01.fits share/ir_lib_cs17.fits
15-
share/mass_func_candels.fits share/opt_lib_fast.fits
15+
share/mass_func_candels.fits share/opt_lib_fast.fits share/opt_lib_fast_noigm.fits
1616
DESTINATION ${EGG_SHARE_DIR} COMPONENT data)
1717
install(DIRECTORY share/filter-db
1818
DESTINATION ${EGG_SHARE_DIR} COMPONENT data)

share/opt_lib_fast_noigm.fits

18.7 MB
Binary file not shown.

src/egg-gencat.cpp

+67-3
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ int phypp_main(int argc, char* argv[]) {
6060
bool no_dust = false; // do not generate fluxes from dust origin
6161
bool no_random = false; // disable all randomization of parameters
6262
// (just passive, M*, z, and position + pos angle)
63+
64+
// Approximations
65+
bool naive_igm = false; // use a fixed IGM absorption for all galaxies (faster)
66+
67+
6368
// Debug - testing
6469
bool no_passive_lir = false; // do not generate dust for passive galaxies
6570
bool magdis_tdust = false; // use Magdis+12 Tdust evolution (lower)
@@ -75,7 +80,7 @@ int phypp_main(int argc, char* argv[]) {
7580

7681
// SED libraries
7782
std::string ir_lib_file = egg_share_dir+"ir_lib_cs17.fits";
78-
std::string opt_lib_file = egg_share_dir+"opt_lib_fast.fits";
83+
std::string opt_lib_file;
7984

8085
// Filter library
8186
std::string filter_db_file = filters_dir+"db.dat";
@@ -127,7 +132,7 @@ int phypp_main(int argc, char* argv[]) {
127132
verbose, name(tseed, "seed"), name(tcosmo, "cosmo"),
128133
name(input_cat_file, "input_cat"), selection_band, bands, rfbands, help, list_bands,
129134
clust_r0, clust_r1, clust_lambda, clust_eta, clust_fclust_mlim, clust_fclust_lom,
130-
clust_fclust_him, clust_urnd_mlim, magdis_tdust
135+
clust_fclust_him, clust_urnd_mlim, magdis_tdust, naive_igm
131136
));
132137

133138
if (help) {
@@ -249,6 +254,14 @@ int phypp_main(int argc, char* argv[]) {
249254
}
250255
}
251256

257+
if (opt_lib_file.empty()) {
258+
if (naive_igm) {
259+
opt_lib_file = egg_share_dir+"opt_lib_fast.fits";
260+
} else {
261+
opt_lib_file = egg_share_dir+"opt_lib_fast_noigm.fits";
262+
}
263+
}
264+
252265
// Initialize random seed and cosmology
253266
// ------------------------------------
254267
auto seed = make_seed(tseed);
@@ -1582,6 +1595,47 @@ if (!no_flux) {
15821595
bulge, disk
15831596
};
15841597

1598+
auto apply_igm = [&](double z, const vec1f& lam, vec1f& sed) {
1599+
// http://adsabs.harvard.edu/abs/1995ApJ...441...18M
1600+
// TODO: check this implementation someday, I suspect this is wrong or
1601+
// very approximate (taken directly from FAST)
1602+
1603+
double da; {
1604+
double l0 = 1050.0*(1.0 + z);
1605+
double l1 = 1170.0*(1.0 + z);
1606+
uint_t nstep = 100;
1607+
vec1d tl = rgen(l0, l1, nstep);
1608+
vec1d ptau = exp(-3.6e-3*pow(tl/1216.0, 3.46));
1609+
da = total(ptau)*(l1-l0)/nstep/(120.0*(1.0 + z));
1610+
}
1611+
1612+
double db; {
1613+
double l0 = 920.0*(1.0 + z);
1614+
double l1 = 1015.0*(1.0 + z);
1615+
uint_t nstep = 100;
1616+
vec1d tl = rgen(l0, l1, nstep);
1617+
vec1d ptau = exp(-1.7e-3*pow(tl/1026.0, 3.46) - 1.2e-3*pow(tl/972.5, 3.46) -
1618+
9.3e-4*pow(tl/950.0, 3.46));
1619+
db = total(ptau)*(l1-l0)/nstep/(95.0*(1.0 + z));
1620+
}
1621+
1622+
uint_t l0 = lower_bound(lam, 0.0921);
1623+
uint_t l1 = lower_bound(lam, 0.1026);
1624+
uint_t l2 = lower_bound(lam, 0.1216);
1625+
1626+
for (uint_t l : range(l0)) {
1627+
sed.safe[l] = 0;
1628+
}
1629+
for (uint_t l : range(l0, l1)) {
1630+
sed.safe[l] *= db;
1631+
}
1632+
for (uint_t l : range(l1, l2)) {
1633+
sed.safe[l] *= da;
1634+
}
1635+
1636+
return lam;
1637+
};
1638+
15851639
auto get_flux = [&](const vec1f& m, const vec1u& optsed, vec2f& flux, vec2f& rfmag,
15861640
bool no_ir, component cmp) {
15871641

@@ -1606,6 +1660,11 @@ if (!no_flux) {
16061660
merge_add(orlam, irlam, orsed, irsed, rlam, rsed);
16071661
}
16081662

1663+
// Apply IGM absorption
1664+
if (!naive_igm && !no_stellar) {
1665+
apply_igm(out.z[i], rlam, rsed);
1666+
}
1667+
16091668
// Obtain rest-frame magnitudes
16101669
if (!rffilters.empty()) {
16111670
// Redshift the SED @ 10pc
@@ -1755,7 +1814,7 @@ void print_help() {
17551814
}
17561815
};
17571816

1758-
print("egg-gencat v1.0.9");
1817+
print("egg-gencat v1.1.0");
17591818
print("usage: egg-gencat [options]\n");
17601819

17611820
print("List of generic options:");
@@ -1797,6 +1856,11 @@ void print_help() {
17971856
"fully deterministic recipes");
17981857
print("");
17991858

1859+
print("List of approximations:");
1860+
argdoc("naive_igm", "[flag]", "use a fixed IGM absorption for all galaxies instead of using "
1861+
"a redshift-dependent prescription.");
1862+
print("");
1863+
18001864
print("List of sky position related options:");
18011865
argdoc("ra0", "[double, degrees]", "sky position of the center of the field "
18021866
"(right ascension, default: 53.558750)");

0 commit comments

Comments
 (0)