@@ -53,12 +53,15 @@ int main(int argc, char* argv[]) {
5353 // Disable some components of the simulation
5454 bool no_pos = false ; // do not generate positions
5555 bool no_clust = false ; // do not generate clustering
56- bool no_passive_lir = false ; // do not generate dust for passive galaxies
5756 bool no_flux = false ; // do not generate fluxes
5857 bool no_stellar = false ; // do not generate fluxes from stellar origin
5958 bool no_dust = false ; // do not generate fluxes from dust origin
6059 bool no_random = false ; // disable all randomization of parameters
6160 // (just passive, M*, z, and position + pos angle)
61+ // Debug - testing
62+ bool no_passive_lir = false ; // do not generate dust for passive galaxies
63+ bool magdis_tdust = false ; // use Magdis+12 Tdust evolution (lower)
64+
6265
6366 // Save the full spectrum of each galaxy to a file
6467 // Warning: the current implementation will consume a lot of RAM memory
@@ -122,7 +125,7 @@ int main(int argc, char* argv[]) {
122125 verbose, name (tseed, " seed" ), name (tcosmo, " cosmo" ),
123126 name (input_cat_file, " input_cat" ), selection_band, bands, rfbands, help, list_bands,
124127 clust_r0, clust_r1, clust_lambda, clust_eta, clust_frnd_mlim, clust_frnd_lom,
125- clust_frnd_him, clust_urnd_mlim
128+ clust_frnd_him, clust_urnd_mlim, magdis_tdust
126129 ));
127130
128131 if (help) {
@@ -423,16 +426,35 @@ int main(int argc, char* argv[]) {
423426 if (end_with (input_cat_file, " .fits" )) {
424427 fits::input_table tbl (input_cat_file);
425428
429+ // Read main parameters
430+ tbl.read_columns (fits::narrow, ftable (
431+ out.ra , out.dec , out.z , out.m
432+ ));
433+
426434 // See if there is an 'ID' column, else create our own
427435 if (!tbl.read_column (" id" , out.id )) {
428436 out.id = uindgen (out.ra .size ());
429437 }
430438
431- tbl.read_columns (fits::narrow, ftable (
432- out.ra , out.dec , out.z , out.m , out.passive
439+ // See if there is either 'passive' or 'passive_prob'
440+ vec1f passive_prob;
441+ tbl.read_columns (fits::missing | fits::narrow, ftable (
442+ out.lir , out.tdust , out.ir8 , out.passive , passive_prob
433443 ));
434444
435- tbl.read_columns (fits::missing, ftable (
445+ if (out.passive .empty ()) {
446+ if (passive_prob.empty ()) {
447+ error (" you must provide the 'passive' flag in the input catalog, "
448+ " or prodive the 'passive_prob' value" );
449+ return 1 ;
450+ }
451+
452+ // Generate passive flag according to the given probability
453+ out.passive = random_coin (seed, passive_prob);
454+ }
455+
456+ // See if there is data on the IR spectrum
457+ tbl.read_columns (fits::missing | fits::narrow, ftable (
436458 out.lir , out.tdust , out.ir8
437459 ));
438460
@@ -485,7 +507,7 @@ int main(int argc, char* argv[]) {
485507 // Build the redshift bins with logarithmic bins
486508 // To prevent too narrow bins with very few galaxies, we impose a minimum
487509 // redshift width 'min_dz' (only used for the clustering slices)
488- auto make_zbins = [](double zstart, double zend, double dz, double mdz){
510+ auto make_zbins = [](double zstart, double zend, double dz, double mdz) {
489511 vec1d tzb;
490512 double z1 = zstart;
491513 while (z1 < zend) {
@@ -1291,11 +1313,17 @@ if (!no_flux) {
12911313 vec1f oir8 = out.ir8 ;
12921314 vec1f otdust = out.tdust ;
12931315
1294- out.tdust = 4.65 *(out.z -2.0 ) + 31.0
1295- // Starbursts are warmer
1296- + 6.6 *out.rsb
1297- // Massive galaxies are colder (= downfall of SFE)
1298- - 1.5 *min (0.0 , out.z -2.0 )*clamp (out.m - 10.7 , 0.0 , 1.0 );
1316+ out.tdust = 4.65 *(out.z -2.0 ) + 31.0 ;
1317+
1318+ if (magdis_tdust) {
1319+ vec1u idz = where (out.z > 1 );
1320+ out.tdust [idz] = 2.0 *(clamp (out.z [idz], 0.0 , 2.0 )-1.0 ) + 27.0 ;
1321+ }
1322+
1323+ // Starbursts are warmer
1324+ out.tdust += 6.6 *out.rsb ;
1325+ // Massive galaxies are colder (= downfall of SFE)
1326+ out.tdust -= 1.5 *min (0.0 , out.z -2.0 )*clamp (out.m - 10.7 , 0.0 , 1.0 );
12991327
13001328 out.ir8 = (1.95 *min (0.0 , out.z - 2.0 ) + 7.73 )
13011329 // Starburst have larger IR8
0 commit comments