Distributions

The basic required object to create a population synth are a spatial and (optional if a derived luminosity sampler is create) luminosity distribution.

[1]:
%matplotlib inline


import matplotlib.pyplot as plt
from jupyterthemes import jtplot

jtplot.style(context="notebook", fscale=1, grid=False)
purple = "#B833FF"
yellow = "#F6EF5B"

import networkx as nx
import numpy as np
import warnings

warnings.simplefilter("ignore")

popsynth comes with several built in distributions included

[2]:
import popsynth
popsynth.update_logging_level("INFO")


popsynth.list_available_distributions()
Distribution
BPLDistribution
SFRDistribution
ZPowerCosmoDistribution
DeltaDistribution
FlatlandDistribution
Log10NormalDistribution
LogNormalDistribution
ParetoDistribution
SchechterDistribution
ConstantSphericalDistribution
ZPowerSphericalDistribution
SpiralGalaxyDistribution
LogUniLuminiosityDistribution
UniformCosmoDistribution

Creating a simple population synth

First we create a spatial distribution, in the case, a Spherical distribution with a power law density.

[3]:
spatial_distribution = popsynth.ZPowerSphericalDistribution()

spatial_distribution.Lambda = 30
spatial_distribution.delta = -2
spatial_distribution.r_max = 10

And now we create a powerlaw luminosity distribution

[4]:
luminosity_distribution = popsynth.ParetoDistribution()

luminosity_distribution.alpha = 1.5
luminosity_distribution.Lmin = 1

Combining these together with a random seed, we have a population synthesis object

[5]:
pop_gen = popsynth.PopulationSynth(luminosity_distribution=luminosity_distribution,
                                   spatial_distribution = spatial_distribution,
                                   seed=1234


                                  )
[6]:
pop_gen.display()

Luminosity Function

$\displaystyle \frac{\alpha L_{\rm min}^{\alpha}}{L^{\alpha+1}}$
parameter value
0 alpha 1.5
1 Lmin 1.0

Spatial Function

$\displaystyle \Lambda (1+r)^{\delta}$
parameter value
0 Lambda 30
1 delta -2
2 r_max 10
[7]:
population = pop_gen.draw_survey()
 INFO     |  The volume integral is 2304.6599413369304 
 INFO     |  Expecting 2257 total objects 
 INFO     |  applying selection to fluxes 
 WARNING  |  NO HIDDEN OBJECTS 
 INFO     |  Detected 2257 distances 
 INFO     |  Detected 2257 objects out to a distance of 10.00 
[8]:
fig=population.display_obs_fluxes_sphere(background_color="black",size=0.7);

Cosmological Distributions

If we want to create cosmological spatial distributions, we can use some of those that are built in.

[9]:
spatial_distribution = popsynth.ZPowerCosmoDistribution()
spatial_distribution.Lambda = 100
spatial_distribution.delta = -2
spatial_distribution.r_max = 10

These distributions know about the cosmological Universe and have their fluxes computed using the luminosity distance rather than linear distace.

[10]:
luminosity_distribution = popsynth.SchechterDistribution()

luminosity_distribution.alpha = 1.5
luminosity_distribution.Lmin = 1


[11]:
pop_gen = popsynth.PopulationSynth(luminosity_distribution=luminosity_distribution,
                                   spatial_distribution = spatial_distribution,
                                   seed=1234


                                  )
[12]:
pop_gen.display()

Luminosity Function

$\displaystyle \frac{1}{L_{\rm min}^{1+\alpha}\Gamma\left(1+\alpha\right)} L^{\alpha} \exp\left[ - \frac{L}{L_{\rm min}}\right]$
parameter value
0 alpha 1.5
1 Lmin 1.0

Spatial Function

$\displaystyle \Lambda (z+1)^{\delta}$
parameter value
0 Lambda 100
1 delta -2
2 r_max 10
[13]:
population = pop_gen.draw_survey()
 INFO     |  The volume integral is 742.0199985657756 
 INFO     |  Expecting 715 total objects 
 INFO     |  applying selection to fluxes 
 WARNING  |  NO HIDDEN OBJECTS 
 INFO     |  Detected 715 distances 
 INFO     |  Detected 715 objects out to a distance of 9.67 
[14]:
fig=population.display_obs_fluxes_sphere(cmap="viridis", background_color="black",size=0.7);

The cosmological parameters used when simulating are stored in the cosmology object:

[15]:
popsynth.cosmology.Om
[15]:
0.3070000112056732
[16]:
popsynth.cosmology.h0
[16]:
67.69999694824219
[17]:
popsynth.cosmology.Ode
[17]:
0.6929130577203088

Note: The values of Om and h0 can be changed and will change the values of all cosmological calculations

[18]:
popsynth.cosmology.Om=0.7
[19]:
popsynth.cosmology.Ode
[19]:
0.299913080846911

Let’s re run the last simulation to see how this changes things

[20]:
pop_gen.clean()
 WARNING  |  removing all registered Auxiliary Samplers 
 WARNING  |  removing flux selector 
 WARNING  |  removing distance selector 
 WARNING  |  removing spatial selector 
[21]:
population = pop_gen.draw_survey()
 INFO     |  The volume integral is 378.8422500823972 
 INFO     |  Expecting 359 total objects 
 INFO     |  applying selection to fluxes 
 WARNING  |  NO HIDDEN OBJECTS 
 INFO     |  Detected 359 distances 
 INFO     |  Detected 359 objects out to a distance of 7.12 
[22]:
fig=population.display_obs_fluxes_sphere(background_color="black",size=0.7);
[ ]: