Spaces:
Sleeping
Sleeping
File size: 11,397 Bytes
b43e4df 3e6293f b43e4df |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
# Import packages
import pandas as pd
# Function to fetch simulated fly situation data
def get_fly_situation(canteen):
if canteen == "Deck":
# Sample fly situation data
fly_situation = {
"temperature": 28,
"humidity": 60,
"fly_count": 9,
"last_updated": "2023-11-10 12:00:00"
}
delta1 = '0.2'
delta2 = '2'
delta3 = '1'
elif canteen == "Frontier":
# Sample fly situation data
fly_situation = {
"temperature": 28.1,
"humidity": 62,
"fly_count": 21,
"last_updated": "2023-11-10 12:00:00"
}
delta1 = '0.1'
delta2 = '1'
delta3 = '3'
return fly_situation, delta1, delta2, delta3
# Function to generate a sample fly situation dataset with time series
def get_fly_situation_history(canteen):
if canteen == "Deck":
# Sample fly situation time series data
fly_situation_history = [
{"timestamp": "2023-11-10 11:00:00", "fly_count": 2, "sensor":1},
{"timestamp": "2023-11-10 11:05:00", "fly_count": 1, "sensor": 1},
{"timestamp": "2023-11-10 11:10:00", "fly_count": 2, "sensor": 1},
{"timestamp": "2023-11-10 11:15:00", "fly_count": 2, "sensor": 1},
{"timestamp": "2023-11-10 11:20:00", "fly_count": 3, "sensor": 1},
{"timestamp": "2023-11-10 11:25:00", "fly_count": 1, "sensor": 1},
{"timestamp": "2023-11-10 11:30:00", "fly_count": 2, "sensor": 1},
{"timestamp": "2023-11-10 11:35:00", "fly_count": 1, "sensor": 1},
{"timestamp": "2023-11-10 11:40:00", "fly_count": 3, "sensor": 1},
{"timestamp": "2023-11-10 11:45:00", "fly_count": 1, "sensor": 1},
{"timestamp": "2023-11-10 11:50:00", "fly_count": 2, "sensor": 1},
{"timestamp": "2023-11-10 11:55:00", "fly_count": 3, "sensor": 1},
{"timestamp": "2023-11-10 12:00:00", "fly_count": 1, "sensor": 1},
{"timestamp": "2023-11-10 11:00:00", "fly_count": 1, "sensor": 2},
{"timestamp": "2023-11-10 11:05:00", "fly_count": 2, "sensor": 2},
{"timestamp": "2023-11-10 11:10:00", "fly_count": 3, "sensor": 2},
{"timestamp": "2023-11-10 11:15:00", "fly_count": 1, "sensor": 2},
{"timestamp": "2023-11-10 11:20:00", "fly_count": 2, "sensor": 2},
{"timestamp": "2023-11-10 11:25:00", "fly_count": 2, "sensor": 2},
{"timestamp": "2023-11-10 11:30:00", "fly_count": 1, "sensor": 2},
{"timestamp": "2023-11-10 11:35:00", "fly_count": 3, "sensor": 2},
{"timestamp": "2023-11-10 11:40:00", "fly_count": 2, "sensor": 2},
{"timestamp": "2023-11-10 11:45:00", "fly_count": 1, "sensor": 2},
{"timestamp": "2023-11-10 11:50:00", "fly_count": 3, "sensor": 2},
{"timestamp": "2023-11-10 11:55:00", "fly_count": 2, "sensor": 2},
{"timestamp": "2023-11-10 12:00:00", "fly_count": 2, "sensor": 2},
{"timestamp": "2023-11-10 11:00:00", "fly_count": 3, "sensor": 3},
{"timestamp": "2023-11-10 11:05:00", "fly_count": 1, "sensor": 3},
{"timestamp": "2023-11-10 11:10:00", "fly_count": 2, "sensor": 3},
{"timestamp": "2023-11-10 11:15:00", "fly_count": 2, "sensor": 3},
{"timestamp": "2023-11-10 11:20:00", "fly_count": 1, "sensor": 3},
{"timestamp": "2023-11-10 11:25:00", "fly_count": 3, "sensor": 3},
{"timestamp": "2023-11-10 11:30:00", "fly_count": 2, "sensor": 3},
{"timestamp": "2023-11-10 11:35:00", "fly_count": 1, "sensor": 3},
{"timestamp": "2023-11-10 11:40:00", "fly_count": 1, "sensor": 3},
{"timestamp": "2023-11-10 11:45:00", "fly_count": 2, "sensor": 3},
{"timestamp": "2023-11-10 11:50:00", "fly_count": 2, "sensor": 3},
{"timestamp": "2023-11-10 11:55:00", "fly_count": 3, "sensor": 3},
{"timestamp": "2023-11-10 12:00:00", "fly_count": 6, "sensor": 3},
]
elif canteen == "Frontier":
# Sample fly situation time series data
fly_situation_history = [
{"timestamp": "2023-11-10 11:00:00", "fly_count": 2, "sensor":1},
{"timestamp": "2023-11-10 11:05:00", "fly_count": 5, "sensor": 1},
{"timestamp": "2023-11-10 11:10:00", "fly_count": 6, "sensor": 1},
{"timestamp": "2023-11-10 11:15:00", "fly_count": 4, "sensor": 1},
{"timestamp": "2023-11-10 11:20:00", "fly_count": 5, "sensor": 1},
{"timestamp": "2023-11-10 11:25:00", "fly_count": 2, "sensor": 1},
{"timestamp": "2023-11-10 11:30:00", "fly_count": 5, "sensor": 1},
{"timestamp": "2023-11-10 11:35:00", "fly_count": 6, "sensor": 1},
{"timestamp": "2023-11-10 11:40:00", "fly_count": 7, "sensor": 1},
{"timestamp": "2023-11-10 11:45:00", "fly_count": 8, "sensor": 1},
{"timestamp": "2023-11-10 11:50:00", "fly_count": 10, "sensor": 1},
{"timestamp": "2023-11-10 11:55:00", "fly_count": 9, "sensor": 1},
{"timestamp": "2023-11-10 12:00:00", "fly_count": 8, "sensor": 1},
{"timestamp": "2023-11-10 11:00:00", "fly_count": 1, "sensor": 2},
{"timestamp": "2023-11-10 11:05:00", "fly_count": 2, "sensor": 2},
{"timestamp": "2023-11-10 11:10:00", "fly_count": 3, "sensor": 2},
{"timestamp": "2023-11-10 11:15:00", "fly_count": 2, "sensor": 2},
{"timestamp": "2023-11-10 11:20:00", "fly_count": 3, "sensor": 2},
{"timestamp": "2023-11-10 11:25:00", "fly_count": 4, "sensor": 2},
{"timestamp": "2023-11-10 11:30:00", "fly_count": 6, "sensor": 2},
{"timestamp": "2023-11-10 11:35:00", "fly_count": 7, "sensor": 2},
{"timestamp": "2023-11-10 11:40:00", "fly_count": 8, "sensor": 2},
{"timestamp": "2023-11-10 11:45:00", "fly_count": 10, "sensor": 2},
{"timestamp": "2023-11-10 11:50:00", "fly_count": 9, "sensor": 2},
{"timestamp": "2023-11-10 11:55:00", "fly_count": 8, "sensor": 2},
{"timestamp": "2023-11-10 12:00:00", "fly_count": 6, "sensor": 2},
{"timestamp": "2023-11-10 11:00:00", "fly_count": 3, "sensor": 3},
{"timestamp": "2023-11-10 11:05:00", "fly_count": 2, "sensor": 3},
{"timestamp": "2023-11-10 11:10:00", "fly_count": 2, "sensor": 3},
{"timestamp": "2023-11-10 11:15:00", "fly_count": 2, "sensor": 3},
{"timestamp": "2023-11-10 11:20:00", "fly_count": 1, "sensor": 3},
{"timestamp": "2023-11-10 11:25:00", "fly_count": 3, "sensor": 3},
{"timestamp": "2023-11-10 11:30:00", "fly_count": 5, "sensor": 3},
{"timestamp": "2023-11-10 11:35:00", "fly_count": 7, "sensor": 3},
{"timestamp": "2023-11-10 11:40:00", "fly_count": 6, "sensor": 3},
{"timestamp": "2023-11-10 11:45:00", "fly_count": 3, "sensor": 3},
{"timestamp": "2023-11-10 11:50:00", "fly_count": 2, "sensor": 3},
{"timestamp": "2023-11-10 11:55:00", "fly_count": 1, "sensor": 3},
{"timestamp": "2023-11-10 12:00:00", "fly_count": 7, "sensor": 3},
]
return fly_situation_history
# Function to get dataframe of camera locations
def get_camera_locations(canteen):
if canteen == 'Frontier':
camera_locations = pd.DataFrame({
"latitude": [1.2963134225592299, 1.2965099487866827, 1.2962607611149572],
"longitude": [103.78033553238319, 103.78067954132742, 103.78017467389839],
"size": [1 for i in range(3)]
})
elif canteen == 'Deck':
camera_locations = pd.DataFrame({
"latitude": [1.2948580016451805, 1.2947091254796532, 1.2944617283028779],
"longitude": [103.77238596429575, 103.77266955821814, 103.77246151634456],
"size": [1 for i in range(3)]
})
return camera_locations
# Function to get pheremone levels
def get_pheremone_levels(sensor):
pheremone_levels_history = [
{"timestamp": "2023-11-10 11:00:00", "pheremone_level": 75, "sensor":1},
{"timestamp": "2023-11-10 11:05:00", "pheremone_level": 75, "sensor": 1},
{"timestamp": "2023-11-10 11:10:00", "pheremone_level": 74, "sensor": 1},
{"timestamp": "2023-11-10 11:15:00", "pheremone_level": 74, "sensor": 1},
{"timestamp": "2023-11-10 11:20:00", "pheremone_level": 74, "sensor": 1},
{"timestamp": "2023-11-10 11:25:00", "pheremone_level": 74, "sensor": 1},
{"timestamp": "2023-11-10 11:30:00", "pheremone_level": 73, "sensor": 1},
{"timestamp": "2023-11-10 11:35:00", "pheremone_level": 72, "sensor": 1},
{"timestamp": "2023-11-10 11:40:00", "pheremone_level": 71, "sensor": 1},
{"timestamp": "2023-11-10 11:45:00", "pheremone_level": 65, "sensor": 1},
{"timestamp": "2023-11-10 11:50:00", "pheremone_level": 63, "sensor": 1},
{"timestamp": "2023-11-10 11:55:00", "pheremone_level": 62, "sensor": 1},
{"timestamp": "2023-11-10 12:00:00", "pheremone_level": 58, "sensor": 1},
{"timestamp": "2023-11-10 11:00:00", "pheremone_level": 95, "sensor": 2},
{"timestamp": "2023-11-10 11:05:00", "pheremone_level": 91, "sensor": 2},
{"timestamp": "2023-11-10 11:10:00", "pheremone_level": 91, "sensor": 2},
{"timestamp": "2023-11-10 11:15:00", "pheremone_level": 90, "sensor": 2},
{"timestamp": "2023-11-10 11:20:00", "pheremone_level": 90, "sensor": 2},
{"timestamp": "2023-11-10 11:25:00", "pheremone_level": 90, "sensor": 2},
{"timestamp": "2023-11-10 11:30:00", "pheremone_level": 90, "sensor": 2},
{"timestamp": "2023-11-10 11:35:00", "pheremone_level": 90, "sensor": 2},
{"timestamp": "2023-11-10 11:40:00", "pheremone_level": 87, "sensor": 2},
{"timestamp": "2023-11-10 11:45:00", "pheremone_level": 84, "sensor": 2},
{"timestamp": "2023-11-10 11:50:00", "pheremone_level": 80, "sensor": 2},
{"timestamp": "2023-11-10 11:55:00", "pheremone_level": 73, "sensor": 2},
{"timestamp": "2023-11-10 12:00:00", "pheremone_level": 72, "sensor": 2},
{"timestamp": "2023-11-10 11:00:00", "pheremone_level": 41, "sensor": 3},
{"timestamp": "2023-11-10 11:05:00", "pheremone_level": 41, "sensor": 3},
{"timestamp": "2023-11-10 11:10:00", "pheremone_level": 40, "sensor": 3},
{"timestamp": "2023-11-10 11:15:00", "pheremone_level": 40, "sensor": 3},
{"timestamp": "2023-11-10 11:20:00", "pheremone_level": 39, "sensor": 3},
{"timestamp": "2023-11-10 11:25:00", "pheremone_level": 38, "sensor": 3},
{"timestamp": "2023-11-10 11:30:00", "pheremone_level": 38, "sensor": 3},
{"timestamp": "2023-11-10 11:35:00", "pheremone_level": 35, "sensor": 3},
{"timestamp": "2023-11-10 11:40:00", "pheremone_level": 34, "sensor": 3},
{"timestamp": "2023-11-10 11:45:00", "pheremone_level": 33, "sensor": 3},
{"timestamp": "2023-11-10 11:50:00", "pheremone_level": 33, "sensor": 3},
{"timestamp": "2023-11-10 11:55:00", "pheremone_level": 30, "sensor": 3},
{"timestamp": "2023-11-10 12:00:00", "pheremone_level": 26, "sensor": 3},
]
return pheremone_levels_history
|