CorSer¶
-
class
pylayers.measures.cormoran.
CorSer
(serie=6, day=11, source='CITI', layout=False)[source]¶ Bases:
pylayers.util.project.PyLayers
Handle CORMORAN measurement data
Hikob data handling from CORMORAN measurement campaign
- 11/06/2014
single subject (Bernard and Nicolas)
- 12/06/2014
several subject (Jihad, Eric , Nicolas)
Attributes Summary
display device techno, id , id on body, body owner,…
display device techno, id , id on body, body owner,…
Methods Summary
align
(devdf, hkbdf)DEPRECATED align time of 2 data frames:
anim
()animhkb
(a, b[, interval, save])Parameters
animhkbAP
(a, AP_list[, interval, save])Parameters
compute_visibility
([techno, square_mda, …])determine visibility of links for a given techno
devmapper
(a[, techno])retrieve name of device if input is number
export_csv
(**kwargs)export to csv devices positions
getdevp
(a[, techno, t, fId])get a device position
getlink
(a, b[, techno, t])get a link value
getlinkd
(a, b[, techno, t])get the distance for a link between devices
getlinkp
(a, b[, technoa, technob, t, fId])get a link devices positions
imshow
([time, kind])DEPRECATED
imshowvisibility
([techno, t])imshow visibility mda
imshowvisibility_i
([techno, t])imshow visibility mda interactive
lk2nd
(lk)transcode a lk from Id to real name
loadlog
()load in self.log the log of the current serie from MeasurementLog.csv
mtlbsave
()Matlab format save
offset_setter
([a, b, techno])offset setter
offset_setter_video
([a, b])video offset setter
plot
(a, b[, techno, t])ploting
pltgt
(a, b, **kwargs)plt ground truth
plthkb
(a, b[, techno])plot Hikob devices
pltlk
(a, b, **kwargs)plot links
pltmob
(**kwargs)plot mobility
plttcr
(a, b, **kwargs)plot TCR devices
pltvisi
(a, b[, techno])plot visibility between link a and b
savemat
()save in Matlab Format
showlink
([a, b, technoa, technob])show link configuation for a given frame
showpattern
(a[, techno])show pattern configuation for a given link and frame
snapshot
([t0, offset, title, save, fig, ax, …])single snapshot plot
snapshots
([t0, t1, offset])take snapshots
visidev
(a, b[, technoa, technob, dsf])get link visibility status
visidev2
(a, b[, technoa, technob, trange])get link visibility status
vlc
()play video of the associated serie
Attributes Documentation
-
ant
¶ display device techno, id , id on body, body owner,…
-
dev
¶ display device techno, id , id on body, body owner,…
Methods Documentation
-
align
(devdf, hkbdf)[source]¶ DEPRECATED align time of 2 data frames:
the time delta of the second data frame is applyied on the first one (e.g. time for devdf donwsampled by hkb data frame time)
devdf : device dataframe hkbdf : hkbdataframe
- devdfc
aligned copy device dataframe
- hkbdfc
aligned copy hkbdataframe
>>> from pylayers.measures.cormoran import * >>> S=CorSer(6) >>> devdf = S.devdf[S.devdf['id']=='HKB:15'] >>> hkbdf = S.hkb['AP1-AnkleLeft'] >>> devdf2,hkbdf2 = S.align(devdf,hkbdf)
-
animhkb
(a, b, interval=10, save=False)[source]¶ a : node name |number b : node name | number save : bool
-
animhkbAP
(a, AP_list, interval=1, save=False, **kwargs)[source]¶ a : node name AP_nb=[] save : bool
>>> from pylayers.measures.cormoran import * >>> S = CorSer(6) >>> S.animhkbAP('TorsoTopLeft',['AP1','AP2','AP3','AP4'],interval=100,xstart=58,figsize=(20,2))
-
compute_visibility
(techno='HKB', square_mda=True, all_links=True)[source]¶ determine visibility of links for a given techno
- techno string
- select the given radio technology of the nodes to determine
the visibility matrix
- square_mda boolean
- select ouput format
True : (device x device x timestamp) False : (link x timestamp)
- all_linksbool
compute all links or just those for which data is available
if square_mda = True
- intersection(ndevice x nbdevice x nb_timestamp)
matrice of intersection (1 if link is cut 0 otherwise)
- links(nbdevice)
name of the links
if square_mda = False
- intersection(nblink x nb_timestamp)
matrice of intersection (1 if link is cut 0 otherwise)
- links(nblink x2)
name of the links
>>> from pylayers.measures.cormoran import * >>> import matplotlib.pyplot as plt >>> C=CorSer(serie=14,day=12) >>> inter,links=C.compute_visibility(techno='TCR',square_mda=True) >>> inter.shape (15, 15, 12473) >>>C.imshowvisibility_i(inter,links)
-
devmapper
(a, techno='')[source]¶ - retrieve name of device if input is number
or retrieve number of device if input is name
- astring
dev name
- iaint
dev number
- bastring
dev refernce in body
- subjectstring
body owning the device
-
export_csv
(**kwargs)[source]¶ export to csv devices positions
- unitstring (‘mm’|’cm’|’m’),
unit of positions in csv(default mm)
- tunit: string
time unit in csv (default ‘ns’)
- ‘alias’: dict
dictionnary to replace name of the devices into the csv . example : if you want to replace a device id named ‘TCR:34’ to an id = 5, you have to add an entry in the alias dictionnary as : alias.update({‘TCR34’:5})
- offsetnp.array
apply an offset on positions
a csv file into the folder <PylayersProject>/netsave
-
getdevp
(a, techno='', t='', fId='')[source]¶ get a device position
- astr | int
name |id
- technostr
radio techno
optional :
- tfloat | list
given time |[time_start,time_stop]
pa : np.array()
>>> from pylayers.measures.cormoran import * >>> S=CorSer(serie=34) >>> a=S.getdevp('AP1','WristLeft')
-
getlink
(a, b, techno='', t='')[source]¶ get a link value
optional :
- technostr
radio techno
- tfloat | list
given time or [start,stop] time
Pandas Serie
>>> from pylayers.measures.cormoran import * >>> S=CorSer(serie=34) >>> S.getlink('AP1','WristLeft')
-
getlinkd
(a, b, techno='', t='')[source]¶ get the distance for a link between devices
optional
- technostr
radio techno
- tfloat | list
given time or [start,stop] time
- distnp.array()
all distances for all timestamps for the given link
>>> from pylayers.measures.cormoran import * >>> S = CorSer(serie=6) >>> d = S.getlinkd('AP1','WristLeft',techno='HKB')
-
getlinkp
(a, b, technoa='', technob='', t='', fId='')[source]¶ get a link devices positions
optional :
- technoastr
radio techno
- technobstr
radio techno
- tfloat | list
given time | [time_start,time_stop]
OR
- fIdint
frame id
pa,pb : np.array()
>>> from pylayers.measures.cormoran import * >>> S=CorSer(serie=34) >>> a,b=S.getlinkp('AP1','WristLeft')
-
imshowvisibility
(techno='HKB', t=0, **kwargs)[source]¶ imshow visibility mda
techno : (HKB|TCR) t : float
time in second
>>> from pylayers.measures.cormoran import * >>> import matplotlib.pyplot as plt >>> C=CorSer(serie=6,day=12) >>> inter,links=C.compute_visibility(techno='TCR',square_mda=True) >>> i,l=C.imshowvisibility_i(inter,links)
pylayers.measures.CorSer.compute_visibility()
-
imshowvisibility_i
(techno='HKB', t=0, **kwargs)[source]¶ imshow visibility mda interactive
inter : (nb link x nb link x timestamps) links : (nblinks) time : intial time (s)
>>> from pylayers.measures.cormoran import * >>> import matplotlib.pyplot as plt >>> C=CorSer(serie=6,day=12) >>> inter,links=C.visimda(techno='TCR',square_mda=True) >>> i,l=C.imshowvisibility_i(inter,links)
-
lk2nd
(lk)[source]¶ transcode a lk from Id to real name
lk : string
>>> C=Corser(6) >>> lk = 'HKB:15-HKB:7' >>> C.lk2nd(lk)
-
mtlbsave
()[source]¶ Matlab format save
- S{day}_{serie}
node_name node_place node_coord
HKB.{linkname}.tr HKB.{linkname}.rssi HKB.{linkname}.td HKB.{linkname}.dist HKB.{linkname}.sh HKB.{linkname}.dsh
TCR.{linkname}.tr HKB.{linkname}.range HKB.{linkname}.td HKB.{linkname}.dist HKB.{linkname}.sh
-
plot
(a, b, techno='', t='', **kwargs)[source]¶ ploting
- astr | int
name |id
- bstr | int
name |id
- technostr (optional)
radio techno
- tfloat | list (optional)
given time or [start,stop] time
color : color distance : boolean (False)
plot distance instead of value
- linboolean (False)
display linear value instead of dB
- sqrtinvboolean (False)
apply : “sqrt (1/ dataset)”
- xoffsetfloat (0)
add an offset on x axis
- yoffsetfloat (1|1e3|1e6)
add an offset on y axis
- titleboolean (True)
display title
- shortlabelboolean (True)
enable short labelling
- fontsizeint (18)
font size
- returnlinesboolean
if True return the matplotlib ploted lines
>>> from pylayers.measures.cormoran import * >>> S = CorSer(6) >>> f,ax = S.plot('AP1','TorsoTopLeft',techno='HKB') >>> f,ax = S.pltvisi('AP1','TorsoTopLeft',techno='HKB',fig=f,ax=ax) >>> #f,ax = S.pltmob(fig=f,ax=ax) >>> #plt.title('hatch = visibility / gray= mobility') >>> plt.show()
-
pltgt
(a, b, **kwargs)[source]¶ plt ground truth
t0 t1 fig ax figsize: tuple linestyle’ inverse :False,
display 1/distance instead of distance
- logboolean
display log for distance intead of distance
- gammma’:1.,
mulitplication factor for log : gamma*log(distance) this can be used to fit RSS
- modestring
‘HKB’ | ‘TCR’ | ‘FULL’
- visiboolean,
display visibility
- color: string color (‘k’|’m’|’g’),
color to display the visibility area
- hatch’: strin hatch type (‘//’)
hatch type to hatch visibility area
- fontsize: int
title fontsize
>>> from pylayers.measures.cormoran import * >>> S=CorSer(6) >>> S.pltgt('AP1','TorsoTopLeft')
-
plthkb
(a, b, techno='HKB', **kwargs)[source]¶ plot Hikob devices
DEPRECATED
a : node name |number b : node name | number t0 : start time t1 : stop time
>>> from pylayers.measures.cormoran import * >>> S = CorSer(6) >>> f,ax = S.plthkb('AP1','TorsoTopLeft',techno='HKB') >>> f,ax = S.pltvisi('AP1','TorsoTopLeft',techno='HKB',fig=f,ax=ax) >>> f,ax = S.pltmob(fig=f,ax=ax) >>> plt.title('hatch = visibility / gray= mobility') >>> plt.show()
-
pltlk
(a, b, **kwargs)[source]¶ plot links
- astring
node a name
- bstring
node b name
- display: list
techno to be displayed
figsize t0: float
time start
- t1float
time stop
colhk: plt.color
color of hk curve
- colhk2:plt.color
color of hk curve2 ( if recirpocal)
- linestylehk:
linestyle hk
- coltcr:
color tcr curve
- coltcr2:
color of tcr curve2 ( if recirpocal)
- linestyletcr:
linestyle tcr
- colgt:
color ground truth
- inversegt:
invert ground truth
- loggt: bool
apply a log10 factor to ground truth
- gammagt:
applly a gamma factor to ground truth (if loggt ! )
- fontsize:
font size of legend
- visi:
display visibility indicator
- axs :
list of matplotlib axes
>>> from pylayers.measures.cormoran import * >>> S=CorSer(6) >>> S.pltlk('AP1','TorsoTopLeft')
-
pltmob
(**kwargs)[source]¶ plot mobility
- subject: str
subject to display () if ‘’, take the fist one from self.subject)
- showvelboolean
display filtered velocity
- velth: float (0.7)
velocity threshold
- foint (5)
filter order
- fw: float (0.02)
0 < fw < 1 (fN <=> 1)
- time_offsetint
add time_offset to start later
>>> from pylayers.measures.cormoran import * >>> S = CorSer(6) >>> f,ax = S.plthkb('AP1','TorsoTopLeft',techno='HKB') >>> #f,ax = S.pltvisi('AP1','TorsoTopLeft',techno='HKB',fig=f,ax=ax) >>> f,ax = S.pltmob(fig=f,ax=ax) >>> plt.title('hatch = visibility / gray= mobility') >>> plt.show()
-
plttcr
(a, b, **kwargs)[source]¶ plot TCR devices
a : node name |number b : node name | number t0 : start time t1 : stop time
-
pltvisi
(a, b, techno='', **kwargs)[source]¶ plot visibility between link a and b
- color:
fill color
- hatch:
hatch type
- label_pos: (‘top’|’bottom’|’‘)
postion of the label
- label_pos_off: float
offset of postion of the label
- label_mob: str
prefix of label in mobility
- label_stat: str
prefix of label static
>>> from pylayers.measures.cormoran import * >>> S = CorSer(6) >>> f,ax = S.plthkb('AP1','TorsoTopLeft',techno='HKB') >>> f,ax = S.pltvisi('AP1','TorsoTopLeft',techno='HKB',fig=f,ax=ax) >>> f,ax = S.pltmob(fig=f,ax=ax) >>> plt.title('hatch = visibility / gray= mobility') >>> plt.show()
-
showlink
(a='AP1', b='BackCenter', technoa='HKB', technob='HKB', **kwargs)[source]¶ show link configuation for a given frame
- aint
link index
- bint
link index
- technoastring
default ‘HKB’|’TCR’|’BS’
- technob
default ‘HKB’|’TCR’|’BS’
- phifloat
antenna elevation in rad
-
showpattern
(a, techno='HKB', **kwargs)[source]¶ show pattern configuation for a given link and frame
- aint
link index
- technoastring
‘HKB’|’TCR’|’BS’
- technob
default ‘HKB’|’TCR’|’BS’
- phifloat
antenna elevation in rad
fig : ax : t : float phi : float
pi/2
ap : boolean
-
snapshot
(t0=0, offset=15.5, title=True, save=False, fig=[], ax=[], figsize=(10, 10))[source]¶ single snapshot plot
t0: float offset : float title : boolean save : boolean fig ax figsize : tuple
-
visidev
(a, b, technoa='HKB', technob='HKB', dsf=10)[source]¶ get link visibility status
- visipandas Series
0 : LOS 1 : NLOS