sbird / fake_spectra

A code for generating fake spectra from a cosmological simulation
MIT License
12 stars 13 forks source link

Understand distribution of velocities #3

Closed andreufont closed 7 years ago

andreufont commented 7 years ago

I took one of the Gadget3 sims and made a histogram of line of sight velocities (weighted by density), on each of the three possible axes. The relevant lines of code are: vel=spec.get_velocity(elem='H',ion=-1) (pdf,bins)=np.histogram(vel,bins=101,density=True) bins=(bins[1:] + bins[:-1])/2. plt.plot(bins,pdf,label=label)

The plot I obtain is attached. Solid lines show positive velocities, and dashed lines show negative velocities, in the three axes. There are two interesting issues:

velocity_test_z3 0

sbird commented 7 years ago

I'm having difficulty reading the labels - is it true that x,y,z are all identical, even for v<0 ?

andreufont commented 7 years ago

They are not quite identical, but they do look extremely similar in this plot. If I look, for instance, at the minimum, mean, and maximum value of the velocity in each of the axes (for a smaller sample), I get the following: x: min = -74.1074, mean = -0.00549138, max = 99.0607 y: min = -80.4283, mean = -0.00141564, max = 74.0861 z: min = -78.0453, mean = -0.00507216, max = 74.547

sbird commented 7 years ago

Ok, thanks - that fortunately rules out an indexing error somewhere!

sbird commented 7 years ago

At least, it rules out one type of indexing error

sbird commented 7 years ago

Hmmm - what spectra are you using? When I try and reproduce this I get an asymmetry indeed, but it has a different sign depending on which axis I use, which suggests to me it is just a statistical fluctuation

sbird commented 7 years ago

Also, look at the distribution of the raw velocities in the snapshot - they are also slightly asymmetric, but by differing amounts for each axis. I think this might just be an artefact of the box being small.