ArraySquareCell

class ArraySquareCell(ncel_x=1, ncel_y=1, size_cm=1.0)[source]

Bases: object

Constructor

Parameters:
  • ncel_x (int>0. Default is 1.) – number of cells along x axis.
  • ncel_y (int>0. Default is 1.) – number of cells along y axis.
  • size_cm (float>0. DEfault is 1.0) – area size of the square array in cm2.

Methods Summary

add_hit(apos) Add one on pixel associated to position
get_ij_cell_surrounded_no_0()
get_nb_cell()
get_nb_cell_x()
get_nb_cell_y()
get_shape()
get_sizecm()
get_surface() return : [cm]^2
idx2pos(array_idx[, pos]) return array position
idx2pos_inf(array_idx)
idx2pos_sup(array_idx)
intersection(o_asc, vec_trans) Intersection entre le tableau en attribut et un tableau passé en paramètre à translater
intersection_rect(p_r1, p_r2)
plot([p_mes])
plot_ijdet([p_mes])
pos2idx(pos_cm[, round_func])
pos2idx_inf(pos_cm) Return index x,y lower left corner of cell containing pos_cm
pos2idx_noround(pos_cm)
pos2idx_rect(p_rect[, p_boundary]) p_rect is one rectangle
pos2idx_sup(pos_cm)
pos_center_cells() Return 2 array x and y with center cells
pos_corner_lb() return : [cm] position corner ‘l’eft ‘b’ottom
pos_corner_ru() return : [cm] position corner ‘r’ight ‘u’pper
pos_rect_array()
pos_rect_cell(idx) for one cell
pos_rect_cells(aidx) Returns physical position of the lower left and upper right corners.
random_pos(nb_pos) random position in all array
random_pos_rect(nb_pos, rec) random position in rectangle given by parameter
random_value(pmin, pmax)
sample_up(pfact) pfact is int
set_array(p_ar) Set the current ArraySquareCell object number of cells with those the p_ar ndarray.
set_origin(p_pos_ori) vector PO where P=pos_array_lb and O: origin
set_origin_center()
set_pos_corner_lb(p_pos_ori) vector OP where P=pos_array_lb and O: origin
set_val(p_val)
surf_intersection_rect(p_r1, p_r2)
value(idx) Return value of a given pixel index.
value_array(aidx) Return value at a given set of pixel indices.
value_at_pos(pos) Return the value at a given physical position.
value_at_pos_check(pos)
zeros_like(p_asc) Initiation of current ArraySquareCell object with parameter of ArraySquareCell p_asc.

Methods Documentation

add_hit(apos)[source]

Add one on pixel associated to position

Parameters:apos (numpy array (n,2)) – array plan position of photon
get_ij_cell_surrounded_no_0()[source]
get_nb_cell()[source]
get_nb_cell_x()[source]
get_nb_cell_y()[source]
get_shape()[source]
get_sizecm()[source]
get_surface()[source]

return : [cm]^2

idx2pos(array_idx, pos='CTR')[source]

return array position

Parameters:
  • array_idx (int) – array index
  • pos (string) – pos = {Center: CTR, left bottom :LB, right up :RU}
idx2pos_inf(array_idx)[source]
idx2pos_sup(array_idx)[source]
intersection(o_asc, vec_trans)[source]

Intersection entre le tableau en attribut et un tableau passé en paramètre à translater return [[x_lb, y_lb], [x_ru, y_ru]] rectangle intersection, lb: left bottom, ru: right uppper

intersection_rect(p_r1, p_r2)[source]
plot(p_mes='')[source]
plot_ijdet(p_mes='')[source]
pos2idx(pos_cm, round_func=None)[source]
pos2idx_inf(pos_cm)[source]

Return index x,y lower left corner of cell containing pos_cm

pos2idx_noround(pos_cm)[source]
pos2idx_rect(p_rect, p_boundary=False)[source]

p_rect is one rectangle

pos2idx_sup(pos_cm)[source]
pos_center_cells()[source]

Return 2 array x and y with center cells

Returns:2 array x and y with center cells
Return type:numpy array
pos_corner_lb()[source]

return : [cm] position corner ‘l’eft ‘b’ottom

pos_corner_ru()[source]

return : [cm] position corner ‘r’ight ‘u’pper

pos_rect_array()[source]
pos_rect_cell(idx)[source]

for one cell

pos_rect_cells(aidx)[source]

Returns physical position of the lower left and upper right corners.

Parameters:aidx – list or numpy array-like containing the indices

of the lower left corner :type aidx: [[ll_x_idx1, ll_y_idx1], [ll_x_idx2, ll_y_idx2], …] :return: list of the physical coord. of the ll and ur corners. :rtype: list of numpy-like arrays

random_pos(nb_pos)[source]

random position in all array

Parameters:nb_pos (int) – number position to random
random_pos_rect(nb_pos, rec)[source]

random position in rectangle given by parameter return : nb_pos random position in rec

random_value(pmin, pmax)[source]
sample_up(pfact)[source]

pfact is int

result: repeat pfactxpfact each element

set_array(p_ar)[source]

Set the current ArraySquareCell object number of cells with those the p_ar ndarray.

Parameters:p_ar (array) – array model
set_origin(p_pos_ori: <built-in function array>)[source]

vector PO where P=pos_array_lb and O: origin

Parameters:p_pos_ori (array(float)) – position of the origin
set_origin_center()[source]
set_pos_corner_lb(p_pos_ori: <built-in function array>)[source]

vector OP where P=pos_array_lb and O: origin lb = left bottom

Parameters:p_pos_ori (array(float)) – position of the origin
set_val(p_val)[source]
surf_intersection_rect(p_r1, p_r2)[source]
value(idx)[source]

Return value of a given pixel index.

Parameters:idx ([idx_x, idx_y]) – pixel index
Returns:value
Return type:float
value_array(aidx: <built-in function array>)[source]

Return value at a given set of pixel indices. Generalisation of value() for several indices.

Parameters:idx ([[idx_x, idx_y], .. ]) – pixel indices
Returns:values
Return type:array(float)
value_at_pos(pos)[source]

Return the value at a given physical position.

Parameters:pos ([ll_x, ll_y]) – physical position
Returns:value
Return type:float
value_at_pos_check(pos)[source]
zeros_like(p_asc)[source]

Initiation of current ArraySquareCell object with parameter of ArraySquareCell p_asc.

Parameters:p_asc (ArraySquareCell) – array model