Skip to content

Commit d824b03

Browse files
committed
The input catalog can now contain LIR, IR8 and Tdust
1 parent 0bf4673 commit d824b03

File tree

3 files changed

+86
-8
lines changed

3 files changed

+86
-8
lines changed

doc/EGG.pdf

1.15 KB
Binary file not shown.

doc/doc-egg-gencat.tex

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,11 @@ \subsubsection{Starting from your own galaxies}
208208
pycolfits.writeto('input_cat.fits', cat, clobber=True)
209209
\end{pythoncode}
210210
211+
Optionally, you can also provide your own values for the infrared luminosity ($\lir$, in solar luminosity $\lsun$), the $\ireight$ and $\tdust$ (in Kelvins) in the \texttt{lir}, \texttt{ir8} and \texttt{tdust} columns, respectively. Each of them can be provided independently, depending on which data you have at hands. To let the program randomly generate one of these quantities for a particular galaxy, set the value to NaN.
212+
213+
If there are galaxies for which you provide the $\lir$, the program will adapt its recipes to match what is expected for galaxies of the chosen luminosity. For example, if you give a source a huge IR luminosity, it will be considered as a ``starburst'' and be given a higher dust temperature, among other things). Obviously, if you also provide the $\tdust$ and/or $\ireight$ for these galaxies, these values will be used instead.
214+
215+
In addition, and in order to preserve the statistical quality of the simulated catalog, the program will automatically balance the $\lir$ of the \emph{other} galaxies for which you did not provide a $\lir$. More precisely, for each galaxy with a provided $\lir$, the program will search in the simulated catalog for an existing galaxy with similar properties (stellar mass, redshift and quiescent flag) and the closest $\lir$, and assign it the properties that would have been given to your galaxy if you had not given it your own $\lir$ value.
211216
212217
\subsubsection{Choosing the survey position}
213218

src/egg-gencat.cpp

Lines changed: 81 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,24 @@ int main(int argc, char* argv[]) {
428428
out.id = uindgen(out.ra.size());
429429
}
430430

431-
tbl.read_columns(fits::narrow, ftable(out.ra, out.dec, out.z, out.m, out.passive));
431+
tbl.read_columns(fits::narrow, ftable(
432+
out.ra, out.dec, out.z, out.m, out.passive
433+
));
434+
435+
tbl.read_columns(fits::missing, ftable(
436+
out.lir, out.tdust, out.ir8
437+
));
438+
439+
if (verbose) {
440+
vec1s found;
441+
if (!out.lir.empty()) found.push_back("LIR");
442+
if (!out.tdust.empty()) found.push_back("Tdust");
443+
if (!out.ir8.empty()) found.push_back("IR8");
444+
445+
if (!found.empty()) {
446+
note("found user provided values for "+collapse(found, ", ")+" in the input catalog");
447+
}
448+
}
432449
} else {
433450
file::read_table(input_cat_file, file::find_skip(input_cat_file),
434451
out.id, out.ra, out.dec, out.z, out.m, out.passive
@@ -1080,11 +1097,12 @@ int main(int argc, char* argv[]) {
10801097
out.sfr.resize(ngal);
10811098
out.rsb.resize(ngal);
10821099

1100+
vec1f sfrms;
1101+
10831102
{
10841103
// Active galaxies
10851104
vec1f az = log10(1.0 + out.z);
1086-
vec1f sfrms = out.m - 9.67 + 1.82*az
1087-
- 0.38*sqr(max(0.0, out.m - 9.59 - 2.22*az));
1105+
sfrms = out.m - 9.67 + 1.82*az - 0.38*sqr(max(0.0, out.m - 9.59 - 2.22*az));
10881106

10891107
out.sfr[ida] = sfrms[ida];
10901108

@@ -1269,8 +1287,9 @@ if (!no_flux) {
12691287
}
12701288

12711289
// Tdust and IR8 as observed in stacks and detections of Herschel galaxies
1272-
out.tdust.resize(ngal);
1273-
out.ir8.resize(ngal);
1290+
vec1f olir = out.lir;
1291+
vec1f oir8 = out.ir8;
1292+
vec1f otdust = out.tdust;
12741293

12751294
out.tdust = 4.65*(out.z-2.0) + 31.0
12761295
// Starbursts are warmer
@@ -1290,12 +1309,66 @@ if (!no_flux) {
12901309
out.ir8 *= e10(0.1*randomn(seed, ngal));
12911310
}
12921311

1312+
out.lir = out.sfrir/1.72e-10;
1313+
1314+
// Function to update a source's properties if its LIR is changed
1315+
auto update_properties = [&out,&sfrms](uint_t id) {
1316+
out.sfrir[id] = out.lir[id]*1.72e-10;
1317+
out.sfr[id] = out.sfruv[id] + out.sfrir[id];
1318+
out.irx[id] = out.sfrir[id]/out.sfruv[id];
1319+
double orsb = out.rsb[id];
1320+
out.rsb[id] = log10(out.sfr[id]) - sfrms[id];
1321+
out.tdust[id] += 6.6*(out.rsb[id] - orsb);
1322+
out.ir8[id] *= e10(0.43*(max(0.0, out.rsb[id]) - max(0.0, orsb)));
1323+
};
1324+
1325+
// Keep the values provided by the user in the input catalog (if any)
1326+
if (!olir.empty()) {
1327+
vec1u idg = where(is_finite(olir));
1328+
1329+
// For each provided LIR, find the source at a similar redshift and M* with
1330+
// the closest LIR, and give it the old LIR of the provided source.
1331+
// This preserves as much as possible the overall LIR distribution
1332+
for (uint_t i : idg) {
1333+
vec1u idl = where(abs(out.m[i] - out.m) < 0.3 &&
1334+
abs(out.z[i] - out.z)/(1.0 + out.z) < 0.1 &&
1335+
!is_finite(olir) && out.passive[i] == out.passive);
1336+
1337+
if (idl.empty()) {
1338+
// No one? Try loosening the constraints a little
1339+
idl = where(abs(out.m[i] - out.m) < 0.4 &&
1340+
abs(out.z[i] - out.z)/(1.0 + out.z) < 0.2 &&
1341+
!is_finite(olir) && out.passive[i] == out.passive);
1342+
}
1343+
1344+
if (idl.empty()) {
1345+
// Found one, give it the old LIR and adjust all its other
1346+
// properties to reflect this change
1347+
uint_t mid = min_id(abs(log10(olir[i]/out.lir[idl])));
1348+
out.lir[mid] = out.lir[i];
1349+
update_properties(mid);
1350+
}
1351+
1352+
out.lir[i] = olir[i];
1353+
update_properties(i);
1354+
}
1355+
}
1356+
1357+
if (!oir8.empty()) {
1358+
vec1u idg = where(is_finite(oir8));
1359+
out.ir8[idg] = oir8[idg];
1360+
}
1361+
1362+
if (!otdust.empty()) {
1363+
vec1u idg = where(is_finite(otdust));
1364+
out.tdust[idg] = otdust[idg];
1365+
}
1366+
1367+
// Make sure the values are valid
12931368
out.ir8 = clamp(out.ir8, 0.48, 22.8); // range allowed by IR library
12941369
out.fpah = 0.267/(out.ir8 - 0.217) - 0.0118;
1370+
out.lir[where(!is_finite(out.lir))] = 0.0;
12951371

1296-
out.lir = out.sfrir/1.72e-10;
1297-
vec1u idb = where(!is_finite(out.lir));
1298-
out.lir[idb] = 0.0;
12991372

13001373
// Assign IR SED
13011374
// -------------

0 commit comments

Comments
 (0)