Skip to content
Snippets Groups Projects
Commit 256f2602 authored by am0ebe's avatar am0ebe
Browse files

change isHabitat to habitat in (0,1,2,3,4), where 0 is noHabitat and 1 is...

 change isHabitat to habitat in (0,1,2,3,4), where 0 is noHabitat and 1 is upperleft corner and so on
parent 5fa28a63
Branches
Tags
No related merge requests found
......@@ -137,14 +137,6 @@ def add_cols( data ):
if pxe:
npxe+=1
# if(pxe):
# print(f"{l[4:10]}")
# print(f"{l[col_habitat:col_habitat+4]}")
# print(f"tag: {tag}")
# print(f"sxe:{sxe}, last_pos:{last_pos}, this_pos:{this_pos}")
# print(f"pxe:{pxe}, last_habitat:{last_habitat}, this_habitat:{this_habitat}")
# input()
l.insert(col_lastdetect,lastdetect)
l.insert(col_sxe, sxe)
l.insert(col_pxe, pxe)
......
#!/usr/bin/python3
# clean, sort, merge raw data
# output should be one huge table with all necessary fields for further processing/vizualization
#
# files are 'skyglow.log','tags' and trackfiles (containing 'unit-x' in name, where x is a number
# output one huge table with all necessary fields for further processing/vizualization
#
# files are 'skyglow.log','tags' and trackfiles (containing 'unit-x' in name, where x is a number)
#
############################
# TODO
......@@ -102,8 +103,6 @@ def initFileStructure():
A_DELIM=';'
A_MINLEN = 39
A_MAXLEN = 44
# A_MINLEN = 35
# A_MAXLEN = 49
A_NCOLS = 7 #/w comments
A_COL_SPECIES=1
A_COL_SPECIES_IND=0
......@@ -245,7 +244,7 @@ class Data:
lines = self.clean(lines, T_MINLEN, T_MAXLEN, T_NCOLS, T_DELIM, self.getTrackTime)
if not lines:
pp("-> empty or non-usable data!")
pp("-> empty // non-usable")
return []
uid=getUID(fileName)
......@@ -265,10 +264,20 @@ class Data:
x = int(cols[T_COL_X])
y = int(cols[T_COL_Y])
isHabitat = not ( x==3 or x==4 or y==3 or y==4 )
# add columns (date,time,uid,isHabitat)
line = line[:idx_after_ms] + DELIM + date + DELIM + time + DELIM + str(uid) + DELIM + str(isHabitat) + line[idx_after_ms:]
if x in (1,2) and y in (1,2):
habitat=1
elif x in (5,6) and y in (1,2):
habitat=2
elif x in (1,2) and y in (5,6):
habitat=3
elif x in (5,6) and y in (5,6):
habitat=4
else:
habitat=0
# add columns (date,time,uid,habitat)
line = line[:idx_after_ms] + DELIM + date + DELIM + time + DELIM + str(uid) + DELIM + str(habitat) + line[idx_after_ms:]
if PROJ == "ecolux":
line = line[:line.rindex(DELIM)] # remove signalstrength column
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment