Camera class for 2D projected maps computing. Take a look at documentation figures to get a clearer definition.
Parameters : | center : region of interest center coordinates (default value is [0.5, 0.5, 0.5],
line_of_sight_axis : axis of the line of sight (z axis is the default_value)
up_vector : direction of the y axis of the camera (up). If None, the up vector is set
region_size : projected size of the region of interest (default (1.0, 1.0)) distance : distance of the camera from the center of interest (along the line-of-sight
far_cut_depth : distance of the background (far) cut plane from the center of interest
map_max_size : maximal resolution of the camera (default 1024 pixels) log_sensitive : whether the camera pixels are log sensitive or not (default True). perspectiveAngle : (default 0 = isometric view) angle value in degree which can be used to
|
---|
Examples
>>> cam = Camera(center=[0.5, 0.5, 0.5], line_of_sight_axis='z', region_size=[1., 1.], \
... distance=0.5, far_cut_depth=0.5, up_vector='y', map_max_size=512, log_sensitive=True)
Parameters : | An other camera object : |
---|---|
Returns : | Boolean : True if data needed for this camera view include all data
|
Returns a copy of this camera.
Return xyz_coords deprojected coordinates of a set of points from given [u,v,w] coordinates : - (u=0,v=0, w=0) is the center of the camera. - v is the coordinate along the vaxis - w is the depth coordinate of the points along the line-of-sight of the camera. if origins is True, perform a vectorial transformation of the vectors described by uvw_points anchored at positions ‘origins’
Returns a camera from a HDF5 file.
Returns a camera from a csv (Comma Separated Values) file.
Get the 3D right eye camera for stereoscopic view, which is made from the original camera with just one rotation around the up vector (angle ang_deg)
Parameters : | ang_deg : float
z_fixed_point : float
|
---|---|
Returns : | right_eye_cam : the right eye Camera object for 3D image processing |
Returns the bounding box of the region of interest in the simulation domain corresponding of the area covered by the camera
Returns the camera u, v and z axis coordinates
Returns the (0.,0.,0.) centered cubic bounding box of the area covered by the camera Parameters ———- reduce_u_v_to_PerspectiveRatio : boolean (default False)
take into account the camera.perspectiveAngle if it is defined to make a perspective projection. This reduce the map u and v (i.e.horizontal and vertical) size with the perspective ratio.
Returns the mask map of the camera. each pixel has an alpha : * 1, if the ray of the pixel intersects the simulation domain * 0, if not Parameters ———- float32 Boolean (default True)
use “float32” numpy dtype array instead of float64 to save memory (when float type is not needed, int8 type will be used anyway)
Returns : | (nx, ny) : (int, int) tuple
|
---|
Returns the surface of any pixel of the camera
Returns the edges value of the camera pixels x/y coordinates The pixel coordinates of the center of the camera is (0,0)
Returns ray_vectors, ray_origins and ray_lengths arrays for ray tracing ray definition
Returns the level of the AMR grid for which the cell size ~ the region size
Returns : | lev : int
|
---|
Returns the (x, y, z) coordinates of the points contained in a slice plane perpendicular to the line-of-sight axis at a given position z.
z — slice plane position along line-of-sight (default 0.0 => center of the region)
Print camera parameters in the console
Return a (coords_uv, depth) tuple where ‘coord_uv’ is the projected coordinates of a set of points on the camera plane. (u=0,v=0) is the center of the camera plane. ‘depth’ is the depth coordinate of the points along the line-of-sight of the camera. Parameters ———- points : numpy array of floats
array of points(x,y,z) coordinates to project
Saves the camera parameters into a HDF5 file.
Saves the camera parameters into a csv (Comma Separated Values) file.
Set the perspectiveAngle (default 0 = isometric view) angle value in degree which can be used to transfom the standard pymses isometric view into a perspective view.
Draftly test if a camera is roughly equal to an other one, just to know in the amrviewer GUI if we need to reload data or not.
Returns the rotation corresponding to the viewing angle of the camera
Returns the transformation corresponding to the viewing angle of the camera
Saves the map and the camera into a HDF5 file Parameters ———- map numpy array
map to save
Function that plots the map with axis + colorbar from an HDF5 file
Parameters : | h5fname : the name of the HDF5 file containing the map img_path : the path in wich the plot img file is to be saved axis_unit : a (length_unit_label, axis_scale_factor) tuple containing :
map_unit : a (map_unit_label, map_scale_factor) tuple containing :
cmap : a Colormap object or any default python colormap string cmap_range : a [vmin, vmax] array for map values clipping (linear scale) fraction : fraction of the total map values below the min. map range (in percent) save_into_png: whether the plot is saved into an png file or not (default True) : discrete : wheter the map values are discrete integer values (default False). for colormap |
---|
Function that plots, from an HDF5 file, the map into a Image and saves it into a PNG file
Parameters : | h5fname : string
img_path : string (default value)
cmap : string or Colormap object (default “jet”)
cmap_range : [vmin, vmax] array (default None)
fraction : float (default None)
discrete : boolean (default False)
ramses_output : Ramses_output
ran : boolean or (float, float) (default None)
adaptive_gaussian_blur : boolean (default False)
drawStarsParam : DrawStarsParameters (default None)
verbose : boolean (default True)
log_sensitive : boolean (default None)
alpha_map_mask : boolean (default True)
Returns : ——- : img : PIL Image
ran = (vmin, vmax) :
|
---|
fraction : fraction (percent) of the total value of the map above the returned vmin value (default 1 %)
Map range computation function. Computes the linear/log (according to the map values scaling) scale map range values of a given map :
- if a user-defined cmap_range is given, then it is used to compute the map range values
- if not, the map range values is computed from a fraction (percent) of the total value of the map parameter. the min. map range value is defined as the value below which there is a fraction of the map (default 1 %)
Parameters : | map : 2D map from wich the map range values are computed log_sensitive : whether the map values are log-scaled or not (True or False) cmap_range : user-defined map range values (linear scale) fraction : fraction of the total map values below the min. map range (in percent) |
---|---|
Returns : | map_range : [float, float]
|
Used to apply log-scale map if the camera captors are log-sensitive. Takes care of null and negative values warning
Parameters : | map : original numpy array of map values |
---|---|
Returns : | map : ~ numpy.log10(map) (takes care of null and negative values) |
Utility class to store parameters for the draw_stars function
Parameters : | adapt_intensity : boolean
rgb : [R, G, B] list of int
PSF : boolean or Colormap object
RT_instensity_dimming : boolean
|
---|
Base Operator generic class
ScalarOperator class
Parameters : | scalar_func : function
|
---|
Examples
>>> # Density field scalar operator
>>> op = ScalarOperator(lambda dset: dset["rho"])
FractionOperator class
Parameters : | up_func : function
down_func : function
|
---|
Examples
>>> # Mass-weighted density scalar operator
>>> num = lambda dset: dset["rho"] * dset.get_sizes()**3
>>> den = lambda dset: dset["rho"]**2 * dset.get_sizes()**3
>>> op = FractionOperator(num, den)
I = \frac{\int\limits_{V} \rho \times \rho \mathrm{d}V}{\int\limits_{V} \rho \mathrm{d}V}
Max. AMR level of refinement operator class
Compute a map made of sampling points
Parameters : | source : Source
camera : Camera
op : Operator
z : float
interpolation : boolean (default False)
use_C_code : boolean (default True)
use_openCL : boolean (default False)
verbose : boolean (default False)
Returns : ——- : map : array
|
---|
MapFFTProcessor class Parameters ———- source : Source
data source
prepare data method : it computes the “self.filtered_source” source attribute for the process(...) method. Load data from disk or from cache if remember_data option is activated. The data are then filtered with the CameraFilter class This uses multiprocessing if possible. Parameters ———- camera : Camera
camera containing all the view params, the filtering is done according to those param
Map processing method
Parameters : | op : Operator
camera : Camera
surf_qty : boolean (default False)
multiprocessing : boolean (default True)
FFTkernelSizeFactor : int or float (default 1)
data_already_prepared : boolean (default False)
random_shift : boolean (default False)
stars_age_instensity_dimming : boolean (default False)
|
---|---|
Returns : | map : array
|
Convolution kernel class
FFT convolution method designed to convolute a dict. of maps into a single map
map_dict : map dict. where the dict. keys are the size of the convolution kernel. cam_dict : ExtendedCamera dict. corrsponding to the different maps of the map dict.
2D Gaussian splatter convolution kernel
2D Gaussian splatter convolution kernel
2D pyramidal splatter convolution kernel
2D Squared cosine splatter convolution kernel
RayTracer class
Parameters : | ramses_output : RamsesOutput
field_list : list of string
|
---|
Map processing method : ray-tracing through data cube
Parameters : | op : Operator
camera : Camera
surf_qty : boolean (default False)
verbose : boolean (default False)
multiprocessing : boolean (default True)
source : class:~pymses.sources... (default None)
use_hilbert_domain_decomp : boolean (default True)
use_C_code : boolean (default True)
use_bottom_up : boolean (default False)
|
---|
RayTracerDir class
Parameters : | ramses_output : RamsesOutput
field_list : list of string
|
---|
Map processing method : directional ray-tracing through AMR tree
Parameters op : Operator
physical scalar quantity data operator
RayTracer class
Parameters : | ramses_output : RamsesOutput
field_list : list of string
remember_data : boolean (default False)
|
---|
Map processing method using MPI: ray-tracing through data cube
Parameters : | op : Operator
camera : Camera
surf_qty : boolean (default False)
use_balanced_cpu_list : boolean (default False)
testing_ray_number_max : boolean (default 100)
verbose : boolean (default False)
use_C_code : boolean (default True)
|
---|