lightrayrider package
Submodules
lightrayrider.parallel module
This file is part of LightRayRider, a fast column density computation tool.
- lightrayrider.parallel.py_cone_raytrace_finite(thetas, rhos, x, y, z, a, b, c, d)
Perform ray tracing through a sphere/cone cuts.
Sphere radius is 1, each cone angle defines a region of a certain density.
This function raytraces from the starting coordinates in the direction given and compute the column density of the intersecting segments. Then it will go along the ray in the positive direction until the column density d is reached. The coordinates of that point are stored into (x, y, z).
- Parameters:
cones (regarding the)
- thetas: array
the opening angles of the cones
- rhos: array
density of the cones. For conversion from length to column density.
- x: array
ray start coordinate, x component
- y: array
ray start coordinate, y component
- z: array
ray start coordinate, z component
- a: array
ray direction, x component
- b: array
ray direction, y component
- c: array
ray direction, z component
- d: array
column density where the ray should terminate.
- Returns:
t – end position in multiples of the direction vector. -1 if infinite. Of shape len(x).
- Return type:
array
- lightrayrider.parallel.py_grid_raytrace(rho, x, y, z, a, b, c)
Ray tracing on a grid.
- Parameters:
rho (array) – 3D cube of densities (in units of 1e22/cm^2). For conversion from length to column density. Must be same size in each axis.
lenrho (int) – length of rho.
x (array) – ray start coordinate, x component
y (array) – ray start coordinate, y component
z (array) – ray start coordinate, z component
a (array) – ray direction, x component
b (array) – ray direction, y component
c (array) – ray direction, z component
- Returns:
NHout – column density from the origin to infinity. shape is len(a).
- Return type:
array
- lightrayrider.parallel.py_grid_raytrace_finite(rho, x, y, z, a, b, c, NHmax)
Ray tracing on a grid.
- Parameters:
rho (array) – 3D cube of densities (in units of 1e22/cm^2). For conversion from length to column density. Must be same size in each axis.
x (array) – ray start coordinate, x component
y (array) – ray start coordinate, y component
z (array) – ray start coordinate, z component
a (array) – ray direction, x component
b (array) – ray direction, y component
c (array) – ray direction, z component
NHmax (array) – column density where the ray should terminate.
- Returns:
t – end position in multiples of the direction vector. -1 if infinite. Of shape len(x).
- Return type:
array
- lightrayrider.parallel.py_sphere_raytrace(xx, yy, zz, RR, rho, a, b, c, mindistances)
Perform ray tracing using sphere intersections.
- Parameters:
xx (array) – sphere x coordinates
yy (array) – sphere y coordinates
zz (array) – sphere z coordinates
RR (array) – sphere radii
rho (array) – sphere densities (in units of 1e22/cm^2). For conversion from length to column density.
a (array) – ray direction, x component
b (array) – ray direction, y component
c (array) – ray direction, z component
mindistances (array) – distance from the origin for each subtotal to consider.
- Returns:
NHout – column density from the origin to infinity. shape is (len(mindistances), len(a)).
- Return type:
array
- lightrayrider.parallel.py_sphere_raytrace_count_between(xx, yy, zz, RR, a, b, c)
Count number of spheres lying (partially or completely) between point a,b,c and origin.
Stops counting at 1.
- Parameters:
xx (array) – sphere x coordinates
yy (array) – sphere y coordinates
zz (array) – sphere z coordinates
RR (array) – sphere radii
a (array) – ray direction, x component
b (array) – ray direction, y component
c (array) – ray direction, z component
- Returns:
n – number of spheres
- Return type:
int
- lightrayrider.parallel.py_sphere_raytrace_finite(xx, yy, zz, RR, rho, x, y, z, a, b, c, NHmax)
Perform ray tracing using sphere intersections.
- Parameters:
xx (array) – sphere x coordinates
yy (array) – sphere y coordinates
zz (array) – sphere z coordinates
RR (array) – sphere radii
rho (array) – sphere densities (in units of 1e22/cm^2). For conversion from length to column density.
x (array) – ray start coordinate, x component
y (array) – ray start coordinate, y component
z (array) – ray start coordinate, z component
a (array) – ray direction, x component
b (array) – ray direction, y component
c (array) – ray direction, z component
NHmax (array) – column density where the ray should terminate.
- Returns:
t – end position in multiples of the direction vector. -1 if infinite. Of shape len(x).
- Return type:
array
- lightrayrider.parallel.py_sphere_sphere_collisions(xx, yy, zz, RR, kstop)
Marks the first kstop non-intersecting spheres.
- Parameters:
xx (array) – sphere x coordinates
yy (array) – sphere y coordinates
zz (array) – sphere z coordinates
RR (array) – sphere radii
k (int) – number of spheres desired
- Returns:
NHout (array) – 1 if collides with another sphere of lower index, 2 if okay.
Parameters regarding the spheres
- lightrayrider.parallel.py_voronoi_raytrace(xx, yy, zz, RR, rho, a, b, c, mindistances)
Ray tracing using nearest point density.
- Parameters:
xx (array) – x coordinates
yy (array) – y coordinates
zz (array) – z coordinates
RR (array) – radii
rho (array) – sphere densities. For conversion from length to column density.
a (array) – ray direction, x component
b (array) – ray direction, y component
c (array) – ray direction, z component
mindistances (array) – distance from the origin for each subtotal to consider.
- Returns:
NHout – column density from the origin to infinity. shape is (len(mindistances), len(a)).
- Return type:
array
lightrayrider.raytrace module
This file is part of LightRayRider, a fast column density computation tool.
- lightrayrider.raytrace.py_cone_raytrace_finite(thetas, rhos, x, y, z, a, b, c, d)
Perform ray tracing through a sphere/cone cuts.
Sphere radius is 1, each cone angle defines a region of a certain density.
This function raytraces from the starting coordinates in the direction given and compute the column density of the intersecting segments. Then it will go along the ray in the positive direction until the column density d is reached. The coordinates of that point are stored into (x, y, z).
- Parameters:
cones (regarding the)
- thetas: array
the opening angles of the cones
- rhos: array
density of the cones. For conversion from length to column density.
- x: array
ray start coordinate, x component
- y: array
ray start coordinate, y component
- z: array
ray start coordinate, z component
- a: array
ray direction, x component
- b: array
ray direction, y component
- c: array
ray direction, z component
- d: array
column density where the ray should terminate.
- Returns:
t – end position in multiples of the direction vector. -1 if infinite. Of shape len(x).
- Return type:
array
- lightrayrider.raytrace.py_grid_raytrace(rho, x, y, z, a, b, c)
Ray tracing on a grid.
- Parameters:
rho (array) – 3D cube of densities (in units of 1e22/cm^2). For conversion from length to column density. Must be same size in each axis.
lenrho (int) – length of rho.
x (array) – ray start coordinate, x component
y (array) – ray start coordinate, y component
z (array) – ray start coordinate, z component
a (array) – ray direction, x component
b (array) – ray direction, y component
c (array) – ray direction, z component
- Returns:
NHout – column density from the origin to infinity. shape is len(a).
- Return type:
array
- lightrayrider.raytrace.py_grid_raytrace_finite(rho, x, y, z, a, b, c, NHmax)
Ray tracing on a grid.
- Parameters:
rho (array) – 3D cube of densities (in units of 1e22/cm^2). For conversion from length to column density. Must be same size in each axis.
x (array) – ray start coordinate, x component
y (array) – ray start coordinate, y component
z (array) – ray start coordinate, z component
a (array) – ray direction, x component
b (array) – ray direction, y component
c (array) – ray direction, z component
NHmax (array) – column density where the ray should terminate.
- Returns:
t – end position in multiples of the direction vector. -1 if infinite. Of shape len(x).
- Return type:
array
- lightrayrider.raytrace.py_sphere_raytrace(xx, yy, zz, RR, rho, a, b, c, mindistances)
Perform ray tracing using sphere intersections.
- Parameters:
xx (array) – sphere x coordinates
yy (array) – sphere y coordinates
zz (array) – sphere z coordinates
RR (array) – sphere radii
rho (array) – sphere densities (in units of 1e22/cm^2). For conversion from length to column density.
a (array) – ray direction, x component
b (array) – ray direction, y component
c (array) – ray direction, z component
mindistances (array) – distance from the origin for each subtotal to consider.
- Returns:
NHout – column density from the origin to infinity. shape is (len(mindistances), len(a)).
- Return type:
array
- lightrayrider.raytrace.py_sphere_raytrace_count_between(xx, yy, zz, RR, a, b, c)
Count number of spheres lying (partially or completely) between point a,b,c and origin.
Stops counting at 1.
- Parameters:
xx (array) – sphere x coordinates
yy (array) – sphere y coordinates
zz (array) – sphere z coordinates
RR (array) – sphere radii
a (array) – ray direction, x component
b (array) – ray direction, y component
c (array) – ray direction, z component
- Returns:
n – number of spheres
- Return type:
int
- lightrayrider.raytrace.py_sphere_raytrace_finite(xx, yy, zz, RR, rho, x, y, z, a, b, c, NHmax)
Perform ray tracing using sphere intersections.
- Parameters:
xx (array) – sphere x coordinates
yy (array) – sphere y coordinates
zz (array) – sphere z coordinates
RR (array) – sphere radii
rho (array) – sphere densities (in units of 1e22/cm^2). For conversion from length to column density.
x (array) – ray start coordinate, x component
y (array) – ray start coordinate, y component
z (array) – ray start coordinate, z component
a (array) – ray direction, x component
b (array) – ray direction, y component
c (array) – ray direction, z component
NHmax (array) – column density where the ray should terminate.
- Returns:
t – end position in multiples of the direction vector. -1 if infinite. Of shape len(x).
- Return type:
array
- lightrayrider.raytrace.py_sphere_sphere_collisions(xx, yy, zz, RR, kstop)
Marks the first kstop non-intersecting spheres.
- Parameters:
xx (array) – sphere x coordinates
yy (array) – sphere y coordinates
zz (array) – sphere z coordinates
RR (array) – sphere radii
k (int) – number of spheres desired
- Returns:
NHout (array) – 1 if collides with another sphere of lower index, 2 if okay.
Parameters regarding the spheres
- lightrayrider.raytrace.py_voronoi_raytrace(xx, yy, zz, RR, rho, a, b, c, mindistances)
Ray tracing using nearest point density.
- Parameters:
xx (array) – x coordinates
yy (array) – y coordinates
zz (array) – z coordinates
RR (array) – radii
rho (array) – sphere densities. For conversion from length to column density.
a (array) – ray direction, x component
b (array) – ray direction, y component
c (array) – ray direction, z component
mindistances (array) – distance from the origin for each subtotal to consider.
- Returns:
NHout – column density from the origin to infinity. shape is (len(mindistances), len(a)).
- Return type:
array
Module contents
LightRayRider is a tiny fast library to compute column densities along a ray.
Supported geometries:
Uniform density grids.
Spheres of varying size, density and position.
Co-centred cones of varying opening angles and density.