-
Notifications
You must be signed in to change notification settings - Fork 25
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
Redshift alignment for simple rays #196
Open
claytonstrawn
wants to merge
9
commits into
trident-project:main
Choose a base branch
from
claytonstrawn:redshift_align
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
claytonstrawn
commented
Mar 31, 2023
all_fields.extend(['x', 'y', 'z']) | ||
data_fields.extend(['x', 'y', 'z']) | ||
all_fields.extend([('gas','x'),('gas','y'),('gas','z')]) | ||
data_fields.extend([('gas','x'),('gas','y'),('gas','z')]) | ||
if use_peculiar_velocity: |
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 change wasn't actually meant to be part of the PR, was just a random bug fix. I don't remember exactly the problem here, but if there is a more elegant solution to this I'm happy to change it
Pull Request Test Coverage Report for Build 33f2556c-6e17-4592-8920-3a0426b6c050
💛 - Coveralls |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When using
make_simple_ray
to run sightlines with TRIDENT for AGORA Cosmorun, we discovered a weird behavior: components were biased towards negative velocities. This was true for all ion lines, at all redshifts, in all codes, so it was clear that it was some kind of TRIDENT behavior. (thinking this bias might be from "running out of components" is what prompted #195, though that ended up not being the case).In fact, what's happening is intended behavior, not a bug, though I would argue users who make simple rays probably don't expect it to work the way it does. Since the line is created in a cosmological simulation, the redshift of the line is taken to be the dataset redshift. However, as the line travels, it goes to lower redshift, so the end of the line is "closer" to the observer. In other words, lines are blueshifted relative to the dataset. So, transforming the wavelengths into velocities using
v_ion = speedoflight*(wl/(line_rest_wl*(1+cosmo_redshift))-1)
gives all the lines a negative velocity of around 100 km/s, which has no relationship with the halo velocity. I tested this by comparing the same sightline twice, once with
end
andstart
reversed, and they were always mirrored around -100 km/s.My solution was to change how
sub_data[('gas','redshift')]
is defined for each lixel by adding a new optional parameterredshift_align
. The prior behavior would align the dataset redshift with the start of the sightline, no matter where it points or where the absorption takes place. I had two ideas for what this should be replaced with.redshift_align = 'center'
gives z>z_ds at the line start, z<z_ds at the line end, and z = z_ds at the midpoint of the line. If you make endpoints like I do, so they are supposed to pass by the galaxy at their midpoint, this will give the cgm aligned with the box, and slightly blueshift the "end" side and redshift the "start" side.redshift_align = 'everywhere'
gives z = z_ds for the whole duration of the line. (this was my first solution, because it was easier to figure out)The pro of 'center' is that the line is more cosmologically realistic, the pro of 'everywhere' is that the velocities are more intuitively correct, i.e. velocity on this graph is the real LOS velocity of the cloud. The difference is minor but noticeable, but in any case it is much less significant than defaulting to 'start'. I added both as options here. If the user passes in some other argument, I figured "everywhere" is the most simple option, so I added a warning and used that.
I don't think this makes sense for
complex_rays
, so I didn't add it to that function, though would be happy to discuss that if anyone wants. I don't understand howcomplex_rays
work nearly as well, and have never made one.