Rays

class pylayers.antprop.rays.Rays(pTx, pRx)[source]

Bases: pylayers.util.project.PyLayers, dict

Class handling a set of rays

pTxnp.array

transmitter (3,)

pRxnp.array

receiver (3,)

B : IntB B0 : IntB I : Interactions I.I : np.array

(f,nI,3,3)

I.T : IntT I.T.A : np.array

(f,iT,3,3)

I.R : IntR I.R.A : np.array

(f,iR,3,3)

I.D : IntD I.D.A : np.array

(f,iD,3,3)

Lfilenamestring

Layout name

delaysnp.array

ray delays

disnp.array

ray distance = delays*0.3

nrayint

number of rays

evaluatedboolean

are rays evaluated ?

is3Dboolean

are rays 2d or 3d rays ?

isbasedboolean

locbas has been applied ?

fillesboolean

filled has been applied ?

losboolean

Line of sight boolean

fGHznp.array

frequency points for evaluation

origin_sig_namestring

signature file which produces the rays

The Rays object is obtained from a signature. It is a container for a set of rays between a source and a target point defining a radio link.

Once a Rays object has been obtained in 2D, it is transformed in 3D via the to3D method. This method takes two parameters : the height from floor to ceil, and the number N of multiple reflections to account for.

Once the 3d rays have been calculated, the local basis are evaluated along those rays. This is done through the locbas method

Once the local basis have been calculated the different interactions along rays can be informed via the fillinter method.

Once the interactions are informed the field along rays can be evaluated via the eval method

Methods Summary

a2ir(t)

address ray 2 index ray

check_reciprocity(r)

check ray reciprocity in comparing two reciprocal rays

dump(ir, L[, ifGHz, filename])

dump the full information of a ray in a file

eval([fGHz, bfacdiv, ib])

field evaluation of rays

extract(lnr, L)

Extract a group of rays

extract_old(nr, L)

Extract a single ray

extract_typ_order(L[, nD, nR, nT, llo])

Extract group of rays from a certain type (R|T|D)

fillinter(L[, append])

fill ray interactions

get_rays_slabs(L, ir)

return the slabs for a given interaction index

info(ir[, ifGHz, bB, matrix])

provides information for a given ray r

ir2a(ir)

index ray 2 address ray

length([typ])

calculate length of rays

loadh5([filename, idx])

load rays hdf5 format

locbas(L)

calculate ray local bas

mirror([H, N, za, zb])

mirror a ray termination

ray(r)

returns the index of interactions of r

ray2iidx(ir)

Get interactions index of a given ray

ray2inter(ir, L, Si)

get interaction list (Gi style) from a ray

ray2ityp(r)

return interaction type for a given ray

ray2nbi(r)

Get interaction block/number of interactions of a given ray

ray2sig(ir)

get signature to corresponding ray

ray2sig2d(ir)

get signature to corresponding ray

ray2slab(L, ir)

return the slabs for a given interaction index

rayfromdelay([t0, t1])

returns the indexes of rays between 2 timestamps t0 and t1

rayfromnstr(ls)

returns the indexes of rays for a given interaction list

rayfromseg(ls)

DEPRECATED use raysfromnstr instead

rayfromtyp_order([nD, nR, nT, llo])

Return rays from a given type (R|T|D) to a given order ( number of interaction)

reciprocal()

switch tx and rx

remove_aw(L)

remove AIR interactions

saveh5([idx])

save rays in hdf5 format

show(**kwargs)

plot 2D rays within the simulated environment

show3([L, bdis, bstruc, bbasi, bbaso, id, …])

plot 3D rays within the simulated environment

show3d(ray[, bdis, bbas, bstruc, col, id, …])

plot a set of 3D rays

signature(u[, typ])

extract ray signature

simplify()

slab_nb(ir)

returns the slab numbers of r

sort()

sort rays

to3D(L[, H, N, rmoutceilR])

transform 2D ray to 3D ray

typ(ir[, fromR])

returns interactions list type of a given ray

vis(ir, L)

Methods Documentation

a2ir(t)[source]

address ray 2 index ray

t = (ni,ux)tuple address (group of interactions, index)

ray address

irinteger

ray index

check_reciprocity(r)[source]

check ray reciprocity in comparing two reciprocal rays

r : rays reciprocal to self

dump(ir, L, ifGHz=0, filename='dumpray.ray')[source]

dump the full information of a ray in a file

eval(fGHz=array([2.4]), bfacdiv=False, ib=[])[source]

field evaluation of rays

fGHzarray

frequency in GHz

ib : list of interactions block

extract(lnr, L)[source]

Extract a group of rays

lnr : list of rays indexes L : Layout

extract_old(nr, L)[source]

Extract a single ray

nr : ray index L : Layout

extract_typ_order(L, nD=[1], nR=[1], nT=[1], llo='&&')[source]
Extract group of rays from a certain type (R|T|D)

at a order ( <=> given number of interaction)

list logic operator : llo [op0,op1]

nD <op0> nR <op1> nT

Parameters

L : Layout nD = list|int

requested number of Diffraction

nR = list|int

requested number of Reflection

nT = list|int

requested number of Transmission

llo = list logic operator [op0,op1]

nD <op0> nR <op1> nT

RRays object

New Rays object containing rays matching the typ/order conditions

fillinter(L, append=False)[source]

fill ray interactions

L : Layout append : Boolean

If True append new rays to existing structure

This method adds the following members

I : Interactions B : IntB B0 : IntB

get_rays_slabs(L, ir)[source]

return the slabs for a given interaction index

L : Layout ir : interaction block

numpy array of slabs strings at the shape (ir,r) ir : number of interactions ( of the interaction block) r : number of rays

info(ir, ifGHz=0, bB=True, matrix=False)[source]

provides information for a given ray r

irint

ray index

ifGHzint

frequency index

bB: boolean

display Basis

matrix :

display matrix

ir2a(ir)[source]

index ray 2 address ray

ir : integer

(ni,ux) : tuple address (group of interactions, index)

length(typ=2)[source]

calculate length of rays

typint

men1 : length of all segments 2 : accumulated length

loadh5(filename=[], idx=0)[source]

load rays hdf5 format

idx : int

locbas(L)[source]

calculate ray local bas

L : Layout

This method adds for each group of interactions the following members

normnp.array

3 x i x r (interaction vector)

nstrwallnp.array

nstr of interactions

vsinp.array

3 x (i+1) x r

aodnp.array

2 x r

aoanp.array

2 x r

BoOnp.array

3 x 3 x r

Binp.array

3 x 3 x r

Bonp.array

3 x 3 x r

BiNnp.array

3 x 3 x r

scprnp.array

i x r

thetanp.array

i x r

rays : int nbrays : int rayidx : np.array diffslabs : list diffvect : np.array

(phi0,phi,beta,NN)

mirror(H=3, N=1, za=[], zb=[])[source]

mirror a ray termination

Hfloat

ceil height (default 3m) if H=0 only floor reflection is calculated (outdoor case) if H=-1 floor and ceil reflection are inhibited (2D test case)

Nint

handle the number of mirror reflexions

zafloat

height of the point where the parametrization starts ( e.g. pTx[2])

zbfloat

height of the point where the parametrization ends ( e.g. pRx[2])

ddict

k : zm v: alpham k : zp v: alphap

>>> ptx = np.array([1,1,1.5])
>>> prx = np.array([2,2,1.2])
>>> r = Rays(ptx,prx)
>>> d = r.mirror()
>>> d[-1.5]
array([ 0.55555556])

d is a dictionnary whose keys are heights along the vertical from where are emanating the reflected rays. Values of d are the parameterization (0< () <1) along the ray where are situated the different reflection points.

ray(r)[source]

returns the index of interactions of r

rinteger

ray index

irnd.array

index of interactions of r

ray2iidx(ir)[source]

Get interactions index of a given ray

irinteger

ray index

iidxarray

interaction index

ray2inter(ir, L, Si)[source]

get interaction list (Gi style) from a ray

ir : ray index L : Layout Si : Signatures object

ray2ityp(r)[source]

return interaction type for a given ray

r : integer ray index

ltlist

list of type of interactions

ray2nbi(r)[source]

Get interaction block/number of interactions of a given ray

rinteger

ray index

nbiint

interaction block number

ray2sig(ir)[source]

get signature to corresponding ray

ray2sig2d(ir)[source]

get signature to corresponding ray

ray2slab(L, ir)[source]

return the slabs for a given interaction index

L : Layout ir : interaction block

numpy array of slabs strings at the shape (ir,r) ir : number of interactions ( of the interaction block) r : number of rays

rayfromdelay(t0=0, t1=[])[source]

returns the indexes of rays between 2 timestamps t0 and t1

rayfromnstr(ls)[source]

returns the indexes of rays for a given interaction list

rayfromseg(ls)[source]

DEPRECATED use raysfromnstr instead

rayfromtyp_order(nD=[1], nR=[1], nT=[1], llo='&&')[source]

Return rays from a given type (R|T|D) to a given order ( number of interaction)

list logic operator : llo [‘op0op1’]

nD <op0> nR <op1> nT

nD = list|int

requested number of Diffraction

nR = list|int

requested number of Reflection

nT = list|int

requested number of Transmission

llo = list logic operator [op0,op1]

nD <op0> nR <op1> nT

lrlist

list of ray index matching the typ & order conditions

reciprocal()[source]

switch tx and rx

remove_aw(L)[source]

remove AIR interactions

saveh5(idx=0)[source]

save rays in hdf5 format

idx : int

loadh5

show(**kwargs)[source]

plot 2D rays within the simulated environment

rlistlist (default []= all rays)

list of indices of ray in interaction group

graphstring t

type of graph to be displayed ‘s’,’r’,’t’,..

fig : figure ax : axis L : Layout alpha : float

1

linewidthfloat

0.1

colorstring

‘black’

msint

marker size : 5

layoutboolean

True

pointsboolean

True

ER : ray energy

show3(L=[], bdis=True, bstruc=True, bbasi=False, bbaso=False, id=0, ilist=[], raylist=[], centered=True)[source]

plot 3D rays within the simulated environment

bdisboolean

True

bstrucboolean

True

bbasiboolean

display input basis of each interaction of rays

bbasoboolean

display ouput basis of each interaction of rays

id : int L : Layout object

Layout to be displayed

ilist : list of group of interactions raylist : list of index rays centered : boolean

if True center the layout before display

show3d(ray, bdis=True, bbas=False, bstruc=True, col=array([1, 0, 1]), id=0, linewidth=1)[source]

plot a set of 3D rays

ray : block : int

interaction block

bdisBoolean

if False return .vect filename (True)

bbasBoolean

display local basis (False)

bstrucBoolean

display structure (True)

colndarray() 1x3

color of the ray ([1,0,1])

idInteger

id of the ray (default 0)

linewidthInteger

default 1

signature(u, typ='full')[source]

extract ray signature

utuple orr int

if tuple addr if int index

sig : ndarray

Signature of a ray is store as a member

r[nint][‘sig’]

simplify()[source]
slab_nb(ir)[source]

returns the slab numbers of r

irinteger

ray index

isl : slabs number

sort()[source]

sort rays

TODO : not finished

to3D(L, H=3, N=1, rmoutceilR=True)[source]

transform 2D ray to 3D ray

L : Layout object

Hfloat

ceil height (default 3m) if H= 0 only floor reflection is calculated (outdoor case) if H=-1 floor and ceil reflection are inhibited (2D test case)

Nint

number of mirror reflexions

rmoutceilRbool

Remove ceil reflexions in cycles (Gt nodes) with indoor=False attribute

r3d : Rays

mirror

typ(ir, fromR=True)[source]

returns interactions list type of a given ray

irinteger

ray index

fromRbool

True : get information from signature in R False: get information in R.I

vis(ir, L)[source]