-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added (working but unpolished) scripts to calculate hot has properties. #137
base: master
Are you sure you want to change the base?
Conversation
…s for Flamingo, e.g. density, pressure and entropy profiles, etc.
@jemme07 could you remove the |
And please open a pull request for the changes in the observational data as well, that makes it easier to keep track of things. |
Opened a pull request for the changes in the observational data as well. -> DONE |
Deleted pycache directory.
Done |
abundance_to_solar = np.c_[abundance_to_solar[:, :-1], abundance_to_solar[:, -2], abundance_to_solar[:, -2], abundance_to_solar[:, -1]] #Add columns for Calcium and Sulphur and add Iron at the end | ||
|
||
#Find helium offsets | ||
idx_he = find_idx_he(np.log10(abundances[:, 1]), interp.He_bins) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jemme07 There is an inconsistency here: while idx_n
and idx_T
are determined using the mask joint_mask
, idx_he
is not. As a result, idx_n/idx_T
and idx_he
do not have the same length. This does not give any errors because you use the shorter length (that of idx_n
) to determine the loop count in get_table_interp()
, but it does mean that there is a mismatch between the elements in idx_n/idx_T
and idx_he
. In other words: you are probably using the wrong idx_he
for most of the elements during the interpolation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The interpolation code was written by Joey Braspenning. I'll contact him to take a look. Well spotted!
df_gas['lambda_c'] = np.power(10, xray.interpolate_X_Ray_pandas(np.log10(df_gas.nH.values), np.log10(df_gas.temp.values), df_elements, z, obs_data_dir, band = '0.5-2.0keV', fill_value = -400)) / df_gas.nH.values ** 2 | ||
df_gas['in_FOF'] = mask | ||
|
||
df_elements = df_elements.div(df_elements.hydrogen, axis=0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jemme07 it looks like you are only setting the mass fractions of sulphur and calcium after you used the elemental mass fractions in the X-ray interpolation on line 118. Is this correct? Right now the interpolation is using the same mass fraction as for silicon for these elements. Do the tables already assume the same sulphur/silicon and calcium/silicon?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that is a standard assumption throughout EAGLE&co. Worth adding a comment though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, as @MatthieuSchaller mentioned, this is a standard practice.
|
||
df_gas = pd.DataFrame(data.gas.coordinates.value, columns=['x', 'y', 'z']) | ||
df_gas['temp'] = data.gas.temperatures.value | ||
df_gas['mass'] = data.gas.masses.to('Msun').value.astype(np.float64) * u.Msun.to(u.gram) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a specific reason why you are not simply using data.gas.masses.to("gram").value
? Is this a rounding issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the problem is that the values are really small in grams, and rounding issues arise further down in the calculations and would return either inf of nan.
I tried different hacks here, but if I remember correctly, the only way I made this work is to convert to Msun first using float64, the convert to grams. But there might be a better solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can imagine that rounding issues occur if the masses are stored as single precision. But can't you convert the masses to float64 immediately, without having to convert to Msun first?
""" | ||
Dummy | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a particular reason that this exists?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This dummy was aded as a hacky work around to produce several plots with the same script. That is, we read the particle data only once, make all the calculations (x-ray, entropy, etc) and produce all the plots. Then call the dummy script in the pipeline config.yml to properly link the plots and names in the generated webpage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dummy script was removed in jemme07#1, since @EvgeniiChaikin implemented a feature that allows creating multiple figures with a single script (SWIFTSIM/pipeline#26).
kT = kb / ergs_keV * groups.wtemp.sum() / groups.mass.sum() | ||
p = kT * groups.ne.sum() | ||
s = kT / groups.ne.sum() ** (2./3) | ||
p /= groups.head(1).P500.median() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jemme07 I'm not sure I understand what you are doing here. Looks like you are constructing radial bins and then finding all halos that have particles within a bin. For those particles, you then compute the (total?) pressure and entropy within the bin and then you divide this by the median P500 and S500 of all halos that have particles in this particular bin. Is that right?
Added (working but unpolished) scripts to calculate hot has properties for Flamingo, e.g. density, pressure and entropy profiles, etc.
This needs a lot of housekeeping! Unfortunately, I haven’t got much time on my hands at the moment. @bwvdnbro, could you please help with this?
Everything should work, but it needs tidying up.
It requires the observational data (also needs tidying up) from the fork https://github.com/jemme07/velociraptor-comparison-data.