Commit 80507481 authored by Vikrant Rajan's avatar Vikrant Rajan
Browse files

bokeh detection

parents f5fa5314 35534c45
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Bokeh Plot</title>
<script type="text/javascript" src="https://cdn.pydata.org/bokeh/release/bokeh-1.4.0.min.js"></script>
<script type="text/javascript">
Bokeh.set_log_level("info");
</script>
</head>
<body>
<div class="bk-root" id="b03d2ed8-a7a1-499f-aa5f-c22c979ff227" data-root-id="1001"></div>
<script type="application/json" id="1282">
{"149cb75b-76f2-4300-b404-e01539db6719":{"roots":{"references":[{"attributes":{"mantissas":[1,2,5],"max_interval":500.0,"num_minor_ticks":0},"id":"1047","type":"AdaptiveTicker"},{"attributes":{"base":60,"mantissas":[1,2,5,10,15,20,30],"max_interval":1800000.0,"min_interval":1000.0,"num_minor_ticks":0},"id":"1048","type":"AdaptiveTicker"},{"attributes":{"days":[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]},"id":"1050","type":"DaysTicker"},{"attributes":{"base":24,"mantissas":[1,2,4,6,8,12],"max_interval":43200000.0,"min_interval":3600000.0,"num_minor_ticks":0},"id":"1049","type":"AdaptiveTicker"},{"attributes":{"months":[0,1,2,3,4,5,6,7,8,9,10,11]},"id":"1054","type":"MonthsTicker"},{"attributes":{"months":[0,2,4,6,8,10]},"id":"1055","type":"MonthsTicker"},{"attributes":{"days":[1,4,7,10,13,16,19,22,25,28]},"id":"1051","type":"DaysTicker"},{"attributes":{"days":[1,15]},"id":"1053","type":"DaysTicker"},{"attributes":{"months":[0,6]},"id":"1057","type":"MonthsTicker"},{"attributes":{"formatter":{"id":"1043","type":"BasicTickFormatter"},"minor_tick_line_color":{"value":null},"ticker":{"id":"1018","type":"BasicTicker"}},"id":"1017","type":"LinearAxis"},{"attributes":{"days":[1,8,15,22]},"id":"1052","type":"DaysTicker"},{"attributes":{"desired_num_ticks":1},"id":"1018","type":"BasicTicker"},{"attributes":{},"id":"1058","type":"YearsTicker"},{"attributes":{},"id":"1008","type":"LinearScale"},{"attributes":{"ticker":{"id":"1013","type":"DatetimeTicker"}},"id":"1016","type":"Grid"},{"attributes":{"callback":null},"id":"1004","type":"DataRange1d"},{"attributes":{"months":[0,4,8]},"id":"1056","type":"MonthsTicker"},{"attributes":{"callback":null,"tooltips":[["Start: ","@Start"],["End: ","@End"]]},"id":"1035","type":"HoverTool"},{"attributes":{"dimension":1,"ticker":{"id":"1018","type":"BasicTicker"}},"id":"1021","type":"Grid"},{"attributes":{"overlay":{"id":"1061","type":"BoxAnnotation"}},"id":"1024","type":"BoxZoomTool"},{"attributes":{"num_minor_ticks":5,"tickers":[{"id":"1047","type":"AdaptiveTicker"},{"id":"1048","type":"AdaptiveTicker"},{"id":"1049","type":"AdaptiveTicker"},{"id":"1050","type":"DaysTicker"},{"id":"1051","type":"DaysTicker"},{"id":"1052","type":"DaysTicker"},{"id":"1053","type":"DaysTicker"},{"id":"1054","type":"MonthsTicker"},{"id":"1055","type":"MonthsTicker"},{"id":"1056","type":"MonthsTicker"},{"id":"1057","type":"MonthsTicker"},{"id":"1058","type":"YearsTicker"}]},"id":"1013","type":"DatetimeTicker"},{"attributes":{},"id":"1059","type":"UnionRenderers"},{"attributes":{},"id":"1010","type":"LinearScale"},{"attributes":{"bottom":{"value":0},"fill_alpha":{"value":0.1},"fill_color":{"value":"#1f77b4"},"left":{"field":"left"},"line_alpha":{"value":0.1},"line_color":{"value":"#1f77b4"},"right":{"field":"right"},"top":{"value":1}},"id":"1039","type":"Quad"},{"attributes":{},"id":"1060","type":"Selection"},{"attributes":{},"id":"1027","type":"HelpTool"},{"attributes":{"active_drag":"auto","active_inspect":"auto","active_multi":null,"active_scroll":"auto","active_tap":"auto","tools":[{"id":"1022","type":"PanTool"},{"id":"1023","type":"WheelZoomTool"},{"id":"1024","type":"BoxZoomTool"},{"id":"1025","type":"SaveTool"},{"id":"1026","type":"ResetTool"},{"id":"1027","type":"HelpTool"},{"id":"1035","type":"HoverTool"}]},"id":"1028","type":"Toolbar"},{"attributes":{"formatter":{"id":"1045","type":"DatetimeTickFormatter"},"ticker":{"id":"1013","type":"DatetimeTicker"}},"id":"1012","type":"DatetimeAxis"},{"attributes":{},"id":"1022","type":"PanTool"},{"attributes":{"text":"Motion Graph"},"id":"1002","type":"Title"},{"attributes":{"callback":null},"id":"1006","type":"DataRange1d"},{"attributes":{},"id":"1023","type":"WheelZoomTool"},{"attributes":{"below":[{"id":"1012","type":"DatetimeAxis"}],"center":[{"id":"1016","type":"Grid"},{"id":"1021","type":"Grid"}],"left":[{"id":"1017","type":"LinearAxis"}],"plot_height":300,"plot_width":1000,"renderers":[{"id":"1040","type":"GlyphRenderer"}],"title":{"id":"1002","type":"Title"},"toolbar":{"id":"1028","type":"Toolbar"},"x_range":{"id":"1004","type":"DataRange1d"},"x_scale":{"id":"1008","type":"LinearScale"},"y_range":{"id":"1006","type":"DataRange1d"},"y_scale":{"id":"1010","type":"LinearScale"}},"id":"1001","subtype":"Figure","type":"Plot"},{"attributes":{},"id":"1025","type":"SaveTool"},{"attributes":{},"id":"1026","type":"ResetTool"},{"attributes":{"callback":null,"data":{"left":{"__ndarray__":"5e5YM3P0dkLnGRg0c/R2Qg==","dtype":"float64","shape":[2]},"right":{"__ndarray__":"xbjoM3P0dkLhFpw1c/R2Qg==","dtype":"float64","shape":[2]}},"selected":{"id":"1060","type":"Selection"},"selection_policy":{"id":"1059","type":"UnionRenderers"}},"id":"1037","type":"ColumnDataSource"},{"attributes":{"bottom":{"value":0},"fill_color":{"value":"green"},"left":{"field":"left"},"line_color":{"value":"green"},"right":{"field":"right"},"top":{"value":1}},"id":"1038","type":"Quad"},{"attributes":{},"id":"1043","type":"BasicTickFormatter"},{"attributes":{"bottom_units":"screen","fill_alpha":{"value":0.5},"fill_color":{"value":"lightgrey"},"left_units":"screen","level":"overlay","line_alpha":{"value":1.0},"line_color":{"value":"black"},"line_dash":[4,4],"line_width":{"value":2},"render_mode":"css","right_units":"screen","top_units":"screen"},"id":"1061","type":"BoxAnnotation"},{"attributes":{"source":{"id":"1037","type":"ColumnDataSource"}},"id":"1041","type":"CDSView"},{"attributes":{},"id":"1045","type":"DatetimeTickFormatter"},{"attributes":{"data_source":{"id":"1037","type":"ColumnDataSource"},"glyph":{"id":"1038","type":"Quad"},"hover_glyph":null,"muted_glyph":null,"nonselection_glyph":{"id":"1039","type":"Quad"},"selection_glyph":null,"view":{"id":"1041","type":"CDSView"}},"id":"1040","type":"GlyphRenderer"}],"root_ids":["1001"]},"title":"Bokeh Application","version":"1.4.0"}}
</script>
<script type="text/javascript">
(function() {
var fn = function() {
Bokeh.safely(function() {
(function(root) {
function embed_document(root) {
var docs_json = document.getElementById('1282').textContent;
var render_items = [{"docid":"149cb75b-76f2-4300-b404-e01539db6719","roots":{"1001":"b03d2ed8-a7a1-499f-aa5f-c22c979ff227"}}];
root.Bokeh.embed.embed_items(docs_json, render_items);
}
if (root.Bokeh !== undefined) {
embed_document(root);
} else {
var attempts = 0;
var timer = setInterval(function(root) {
if (root.Bokeh !== undefined) {
clearInterval(timer);
embed_document(root);
} else {
attempts++;
if (attempts > 100) {
clearInterval(timer);
console.log("Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing");
}
}
}, 10, root)
}
})(window);
});
};
if (document.readyState != "loading") fn();
else document.addEventListener("DOMContentLoaded", fn);
})();
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Bokeh Plot</title>
<script type="text/javascript" src="https://cdn.pydata.org/bokeh/release/bokeh-1.4.0.min.js"></script>
<script type="text/javascript">
Bokeh.set_log_level("info");
</script>
</head>
<body>
<div class="bk-root" id="c856ed81-fc51-4993-a543-b1953e0f27f1" data-root-id="1002"></div>
<script type="application/json" id="1283">
{"1e600da5-6854-4e5d-8c7a-fbc2592df22a":{"roots":{"references":[{"attributes":{"days":[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]},"id":"1051","type":"DaysTicker"},{"attributes":{"mantissas":[1,2,5],"max_interval":500.0,"num_minor_ticks":0},"id":"1048","type":"AdaptiveTicker"},{"attributes":{"base":24,"mantissas":[1,2,4,6,8,12],"max_interval":43200000.0,"min_interval":3600000.0,"num_minor_ticks":0},"id":"1050","type":"AdaptiveTicker"},{"attributes":{"months":[0,2,4,6,8,10]},"id":"1056","type":"MonthsTicker"},{"attributes":{"days":[1,4,7,10,13,16,19,22,25,28]},"id":"1052","type":"DaysTicker"},{"attributes":{"months":[0,1,2,3,4,5,6,7,8,9,10,11]},"id":"1055","type":"MonthsTicker"},{"attributes":{"days":[1,15]},"id":"1054","type":"DaysTicker"},{"attributes":{"months":[0,6]},"id":"1058","type":"MonthsTicker"},{"attributes":{"days":[1,8,15,22]},"id":"1053","type":"DaysTicker"},{"attributes":{},"id":"1059","type":"YearsTicker"},{"attributes":{"formatter":{"id":"1047","type":"BasicTickFormatter"},"minor_tick_line_color":{"value":null},"ticker":{"id":"1019","type":"BasicTicker"}},"id":"1018","type":"LinearAxis"},{"attributes":{"months":[0,4,8]},"id":"1057","type":"MonthsTicker"},{"attributes":{"callback":null},"id":"1005","type":"DataRange1d"},{"attributes":{},"id":"1045","type":"DatetimeTickFormatter"},{"attributes":{"num_minor_ticks":5,"tickers":[{"id":"1048","type":"AdaptiveTicker"},{"id":"1049","type":"AdaptiveTicker"},{"id":"1050","type":"AdaptiveTicker"},{"id":"1051","type":"DaysTicker"},{"id":"1052","type":"DaysTicker"},{"id":"1053","type":"DaysTicker"},{"id":"1054","type":"DaysTicker"},{"id":"1055","type":"MonthsTicker"},{"id":"1056","type":"MonthsTicker"},{"id":"1057","type":"MonthsTicker"},{"id":"1058","type":"MonthsTicker"},{"id":"1059","type":"YearsTicker"}]},"id":"1014","type":"DatetimeTicker"},{"attributes":{"ticker":{"id":"1014","type":"DatetimeTicker"}},"id":"1017","type":"Grid"},{"attributes":{"desired_num_ticks":1},"id":"1019","type":"BasicTicker"},{"attributes":{"dimension":1,"ticker":{"id":"1019","type":"BasicTicker"}},"id":"1022","type":"Grid"},{"attributes":{},"id":"1011","type":"LinearScale"},{"attributes":{"overlay":{"id":"1060","type":"BoxAnnotation"}},"id":"1025","type":"BoxZoomTool"},{"attributes":{"bottom":{"value":0},"fill_color":{"value":"green"},"left":{"field":"Start"},"line_color":{"value":"green"},"right":{"field":"End"},"top":{"value":1}},"id":"1039","type":"Quad"},{"attributes":{"formatter":{"id":"1045","type":"DatetimeTickFormatter"},"ticker":{"id":"1014","type":"DatetimeTicker"}},"id":"1013","type":"DatetimeAxis"},{"attributes":{},"id":"1028","type":"HelpTool"},{"attributes":{"bottom_units":"screen","fill_alpha":{"value":0.5},"fill_color":{"value":"lightgrey"},"left_units":"screen","level":"overlay","line_alpha":{"value":1.0},"line_color":{"value":"black"},"line_dash":[4,4],"line_width":{"value":2},"render_mode":"css","right_units":"screen","top_units":"screen"},"id":"1060","type":"BoxAnnotation"},{"attributes":{},"id":"1009","type":"LinearScale"},{"attributes":{"active_drag":"auto","active_inspect":"auto","active_multi":null,"active_scroll":"auto","active_tap":"auto","tools":[{"id":"1023","type":"PanTool"},{"id":"1024","type":"WheelZoomTool"},{"id":"1025","type":"BoxZoomTool"},{"id":"1026","type":"SaveTool"},{"id":"1027","type":"ResetTool"},{"id":"1028","type":"HelpTool"},{"id":"1036","type":"HoverTool"}]},"id":"1029","type":"Toolbar"},{"attributes":{},"id":"1023","type":"PanTool"},{"attributes":{},"id":"1047","type":"BasicTickFormatter"},{"attributes":{"callback":null},"id":"1007","type":"DataRange1d"},{"attributes":{},"id":"1024","type":"WheelZoomTool"},{"attributes":{"text":"Motion Graph"},"id":"1003","type":"Title"},{"attributes":{"callback":null,"tooltips":[["Start","@Start_string"],["End","@End_string"]]},"id":"1036","type":"HoverTool"},{"attributes":{},"id":"1026","type":"SaveTool"},{"attributes":{},"id":"1027","type":"ResetTool"},{"attributes":{"base":60,"mantissas":[1,2,5,10,15,20,30],"max_interval":1800000.0,"min_interval":1000.0,"num_minor_ticks":0},"id":"1049","type":"AdaptiveTicker"},{"attributes":{"source":{"id":"1001","type":"ColumnDataSource"}},"id":"1042","type":"CDSView"},{"attributes":{"bottom":{"value":0},"fill_alpha":{"value":0.1},"fill_color":{"value":"#1f77b4"},"left":{"field":"Start"},"line_alpha":{"value":0.1},"line_color":{"value":"#1f77b4"},"right":{"field":"End"},"top":{"value":1}},"id":"1040","type":"Quad"},{"attributes":{"data_source":{"id":"1001","type":"ColumnDataSource"},"glyph":{"id":"1039","type":"Quad"},"hover_glyph":null,"muted_glyph":null,"nonselection_glyph":{"id":"1040","type":"Quad"},"selection_glyph":null,"view":{"id":"1042","type":"CDSView"}},"id":"1041","type":"GlyphRenderer"},{"attributes":{},"id":"1061","type":"UnionRenderers"},{"attributes":{"callback":null,"data":{"End":{"__ndarray__":"0xn4m3X0dkI=","dtype":"float64","shape":[1]},"End_string":["2019-12-27 12:34:21"],"Start":{"__ndarray__":"iasXm3X0dkI=","dtype":"float64","shape":[1]},"Start_string":["2019-12-27 12:34:18"],"index":[0]},"selected":{"id":"1062","type":"Selection"},"selection_policy":{"id":"1061","type":"UnionRenderers"}},"id":"1001","type":"ColumnDataSource"},{"attributes":{},"id":"1062","type":"Selection"},{"attributes":{"below":[{"id":"1013","type":"DatetimeAxis"}],"center":[{"id":"1017","type":"Grid"},{"id":"1022","type":"Grid"}],"left":[{"id":"1018","type":"LinearAxis"}],"plot_height":300,"plot_width":1000,"renderers":[{"id":"1041","type":"GlyphRenderer"}],"title":{"id":"1003","type":"Title"},"toolbar":{"id":"1029","type":"Toolbar"},"x_range":{"id":"1005","type":"DataRange1d"},"x_scale":{"id":"1009","type":"LinearScale"},"y_range":{"id":"1007","type":"DataRange1d"},"y_scale":{"id":"1011","type":"LinearScale"}},"id":"1002","subtype":"Figure","type":"Plot"}],"root_ids":["1002"]},"title":"Bokeh Application","version":"1.4.0"}}
</script>
<script type="text/javascript">
(function() {
var fn = function() {
Bokeh.safely(function() {
(function(root) {
function embed_document(root) {
var docs_json = document.getElementById('1283').textContent;
var render_items = [{"docid":"1e600da5-6854-4e5d-8c7a-fbc2592df22a","roots":{"1002":"c856ed81-fc51-4993-a543-b1953e0f27f1"}}];
root.Bokeh.embed.embed_items(docs_json, render_items);
}
if (root.Bokeh !== undefined) {
embed_document(root);
} else {
var attempts = 0;
var timer = setInterval(function(root) {
if (root.Bokeh !== undefined) {
clearInterval(timer);
embed_document(root);
} else {
attempts++;
if (attempts > 100) {
clearInterval(timer);
console.log("Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing");
}
}
}, 10, root)
}
})(window);
});
};
if (document.readyState != "loading") fn();
else document.addEventListener("DOMContentLoaded", fn);
})();
</script>
</body>
</html>
\ No newline at end of file
,Start,End
<<<<<<< HEAD
0,2019-12-24 19:35:55.136794,2019-12-24 19:35:58.152620
1,2019-12-24 19:36:08.084905,2019-12-24 19:36:14.872890
2,2019-12-24 19:36:17.911238,2019-12-24 19:36:20.188220
=======
0,2019-12-27 12:34:18.106721,2019-12-27 12:34:21.697614
>>>>>>> master
"""
MOTION DETECTION APPLICATION
"""
import cv2, time, pandas
from datetime import datetime
first_frame = None
status_list = [None, None]
times = []
df = pandas.DataFrame(columns=["Start", "End"])
video = cv2.VideoCapture(0)
while True:
check, frame = video.read()
# 0 = nothing is moving, 1 = motion detected
status = 0
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
gray = cv2.GaussianBlur(gray, (21, 21), 0)
if first_frame is None:
first_frame = gray
continue
delta_frame = cv2.absdiff(first_frame, gray)
thresh_frame = cv2.threshold(delta_frame, 30, 255, cv2.THRESH_BINARY)[1]
thresh_frame = cv2.dilate(thresh_frame, None, iterations=2)
(cnts,__) = cv2.findContours(thresh_frame.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
for contour in cnts:
# checking the area of the objects in camera
if cv2.contourArea(contour) < 10000:
continue
status = 1
(x, y, w, h) = cv2.boundingRect(contour)
cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 255, 0), 3)
status_list.append(status)
status_list = status_list[-2:]
if status_list[-1] == 1 and status_list[-2] == 0:
times.append(datetime.now())
if status_list[-1] == 0 and status_list[-2] == 1:
times.append(datetime.now())
cv2.imshow("Gray Frame", gray)
cv2.imshow("Delta Frame",delta_frame)
cv2.imshow("Threshold Frame",thresh_frame)
cv2.imshow("Color Frame", frame)
key = cv2.waitKey(1)
if key == ord('q'):
if status == 1:
times.append(datetime.now())
break
print(status_list)
print(times)
for i in range(0, len(times), 2):
df = df.append({"Start":times[i], "End": times[i+1]}, ignore_index=True)
df.to_csv("Times.csv")
video.release()
cv2.destroyAllWindows
\ No newline at end of file
from capture import df
from bokeh.plotting import figure, show, output_file
from bokeh.models import HoverTool, ColumnDataSource
df["Start_string"] = df["Start"].dt.strftime("%Y-%m-%d %H:%M:%S")
df["End_string"] = df["End"].dt.strftime("%Y-%m-%d %H:%M:%S")
cds = ColumnDataSource(df)
p = figure(x_axis_type = "datetime", height = 300, width = 1000, title = "Motion Graph")
p.yaxis.minor_tick_line_color = None
p.ygrid[0].ticker.desired_num_ticks = 1
hover = HoverTool(tooltips = [("Start", "@Start_string"),("End", "@End_string")])
p.add_tools(hover)
q = p.quad(left="Start", right = "End", bottom = 0, top = 1, color = "green", source = cds)
output_file("Graph1.html")
show(p)
\ No newline at end of file
,Start,End
0,2019-12-24 19:35:55.136794,2019-12-24 19:35:58.152620
1,2019-12-24 19:36:08.084905,2019-12-24 19:36:14.872890
2,2019-12-24 19:36:17.911238,2019-12-24 19:36:20.188220
"""
MOTION DETECTION APPLICATION
"""
import cv2, time, pandas
from datetime import datetime
first_frame = None
status_list = [None, None]
times = []
df = pandas.DataFrame(columns=["Start", "End"])
video = cv2.VideoCapture(0)
while True:
check, frame = video.read()
status = 0
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
gray = cv2.GaussianBlur(gray, (21, 21), 0)
if first_frame is None:
first_frame = gray
continue
delta_frame = cv2.absdiff(first_frame, gray)
thresh_frame = cv2.threshold(delta_frame, 30, 255, cv2.THRESH_BINARY)[1]
thresh_frame = cv2.dilate(thresh_frame, None, iterations=2)
(cnts,__) = cv2.findContours(thresh_frame.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
for contour in cnts:
# checking the area of the objects in camera
if cv2.contourArea(contour) < 10000:
continue
status = 1
(x, y, w, h) = cv2.boundingRect(contour)
cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 255, 0), 3)
status_list.append(status)
if status_list[-1] == 1 and status_list[-2] == 0:
times.append(datetime.now())
if status_list[-1] == 0 and status_list[-2] == 1:
times.append(datetime.now())
# cv2.imshow("Gray Frame", gray)
# cv2.imshow("Delta Frame",delta_frame)
# cv2.imshow("Threshold Frame",thresh_frame)
cv2.imshow("Color Frame", frame)
key = cv2.waitKey(1)
if key == ord('q'):
if status == 1:
times.append(datetime.now())
break
print(status_list)
print(times)
for i in range(0, len(times), 2):
df = df.append({"Start":times[i], "End": times[i+1]}, ignore_index=True)
df.to_csv("Times.csv")
video.release()
cv2.destroyAllWindows
\ No newline at end of file
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
### Begin DesktopServer - do not edit this and proceeding lines ###
127.0.0.1 wordpress.dev.cc
127.0.0.1 wordpress2.dev.cc
### End DesktopServer - do not edit this and preceeding lines ###
## Local by Flywheel - Start ##
192.168.95.100 wordpress.local #Local Site
192.168.95.100 www.wordpress.local #Local Site
## Local by Flywheel - End ##
import time
from datetime import datetime as dt
hosts_temp="hosts"
hosts_path="/etc/hosts"
redirect="127.0.0.1"
website_list=["www.facebook.com","facebook.com","google.com","www.google.com"]
while True:
if dt(dt.now().year, dt.now().month, dt.now().day, 17) < dt.now() < dt(dt.now().year, dt.now().month, dt.now().day, 18):
print("working hours")
with open(hosts_path,'r+') as file:
content=file.read()
for website in website_list:
if website in content:
pass
else:
file.write(redirect+" "+ website+"\n")
else:
with open(hosts_path,'r+') as file:
content=file.readlines()
file.seek(0)
for line in content:
if not any(website in line for website in website_list):
file.write(line)
file.truncate()
print("partaaayyy")
time.sleep(5)
\ No newline at end of file
This diff is collapsed.
VOLCANX020,NUMBER,NAME,LOCATION,STATUS,ELEV,TYPE,TIMEFRAME,LAT,LON
509.000000000000000,1201-01=,Baker,US-Washington,Historical,3285.000000000000000,Stratovolcanoes,D3,48.7767982,-121.8109970
511.000000000000000,1201-02-,Glacier Peak,US-Washington,Tephrochronology,3213.000000000000000,Stratovolcano,D4,48.1118011,-121.1110001
513.000000000000000,1201-03-,Rainier,US-Washington,Dendrochronology,4392.000000000000000,Stratovolcano,D3,46.8698006,-121.7509995
515.000000000000000,1201-05-,St. Helens,US-Washington,Historical,2549.000000000000000,Stratovolcano,D1,46.1997986,-122.1809998
516.000000000000000,1201-04-,Adams,US-Washington,Tephrochronology,3742.000000000000000,Stratovolcano,D6,46.2057991,-121.4909973
517.000000000000000,1201-06-,West Crater,US-Washington,Radiocarbon,1329.000000000000000,Volcanic field,D7,45.8797989,-122.0810013
518.000000000000000,1201-07-,Indian Heaven,US-Washington,Radiocarbon,1806.000000000000000,Shield volcanoes,D7,45.9297981,-121.8209991
519.000000000000000,1202-01-,Hood,US-Oregon,Historical,3426.000000000000000,Stratovolcano,D3,45.3737984,-121.6910019
521.000000000000000,1202-02-,Jefferson,US-Oregon,Varve Count,3199.000000000000000,Stratovolcano,D6,44.6917992,-121.8010025
522.000000000000000,1202-03-,Blue Lake Crater,US-Oregon,Radiocarbon,1230.000000000000000,Maar,D7,44.4197998,-121.7710037
523.000000000000000,1202-04-,Sand Mountain Field,US-Oregon,Radiocarbon,1664.000000000000000,Cinder cones,D7,44.3797989,-121.9309998
524.000000000000000,1202-05-,Washington,US-Oregon,Radiocarbon,2376.000000000000000,Shield volcano,D6,44.3317986,-121.8310013
525.000000000000000,1202-06-,Belknap,US-Oregon,Radiocarbon,2095.000000000000000,Shield volcanoes,D6,44.2848015,-121.8410034
526.000000000000000,1202-07-,North Sister Field,US-Oregon,Radiocarbon,3074.000000000000000,Complex volcano,D6,44.1697998,-121.7710037
527.000000000000000,1202-08-,South Sister,US-Oregon,Radiocarbon,3157.000000000000000,Complex volcano,D7,44.0998001,-121.7710037
528.000000000000000,1202-09-,Bachelor,US-Oregon,Tephrochronology,2763.000000000000000,Stratovolcano,D7,43.9788017,-121.6809998
531.000000000000000,1202-11-,Newberry Volcano,US-Oregon,Radiocarbon,2434.000000000000000,Shield volcano,D6,43.7218018,-121.2210007
532.000000000000000,1202-10-,Davis Lake,US-Oregon,Radiocarbon,2163.000000000000000,Volcanic field,D7,43.5698013,-121.8209991
534.000000000000000,1202-12-,Devils Garden,US-Oregon,Holocene?,1698.000000000000000,Volcanic field,?,43.5119019,-120.8610001
535.000000000000000,1202-15-,Cinnamon Butte,US-Oregon,Holocene?,1956.000000000000000,Cinder cones,?,43.2407990,-122.1009979
536.000000000000000,1202-13-,Squaw Ridge Lava Field,US-Oregon,Holocene?,1711.000000000000000,Volcanic field,?,43.4719009,-120.7509995
537.000000000000000,1202-14-,Four Craters Lava Field,US-Oregon,Holocene?,1501.000000000000000,Volcanic field,?,43.3609009,-120.6610031
538.000000000000000,1202-16-,Crater Lake,US-Oregon,Radiocarbon,2487.000000000000000,Caldera,D7,42.9299011,-122.1210022
539.000000000000000,1205-01-,Yellowstone,US-Wyoming,Tephrochronology,2805.000000000000000,Calderas,D7,44.4299011,-110.6709976
541.000000000000000,1202-17-,Diamond Craters,US-Oregon,Holocene?,1435.000000000000000,Volcanic field,?,43.0998993,-118.7509995
542.000000000000000,1202-19-,Jordan Craters,US-Oregon,Radiocarbon,1473.000000000000000,Volcanic field,D7,43.1498985,-117.4710007
543.000000000000000,1202-18-,Saddle Butte,US-Oregon,Holocene?,1700.000000000000000,Volcanic field,?,42.9999008,-117.8010025
544.000000000000000,1204-02-,Craters of the Moon,US-Idaho,Radiocarbon,2005.000000000000000,Cinder cones,D7,43.4198990,-113.5009995
545.000000000000000,1204-04-,Hell Half Acre,US-Idaho,Radiocarbon,1631.000000000000000,Shield volcano,D7,43.4999008,-112.4509964
546.000000000000000,1204-01-,Shoshone Lava Field,US-Idaho,Holocene,1478.000000000000000,Shield volcano,D7,43.1799011,-114.3509979
547.000000000000000,1202-20-,Jackies Butte,US-Oregon,Holocene?,1418.000000000000000,Volcanic field,?,42.6058998,-117.5810013
548.000000000000000,1203-02-,Medicine Lake,US-California,Radiocarbon,2412.000000000000000,Shield volcano,D6,41.5798988,-121.5709991
549.000000000000000,1204-03-,Wapi Lava Field,US-Idaho,Radiocarbon,1604.000000000000000,Shield volcano,D7,42.8799019,-113.2210007
550.000000000000000,1203-01-,Shasta,US-California,Historical,4317.000000000000000,Stratovolcano,D4,41.4198990,-122.2009964
551.000000000000000,1203-03-,Brushy Butte,US-California,Holocene?,1174.000000000000000,Shield volcano,?,41.1778984,-121.4410019
552.000000000000000,1203-04-,Big Cave,US-California,Holocene?,1259.000000000000000,Shield volcano,?,40.9548988,-121.3610001
553.000000000000000,1203-05-,Twin Buttes,US-California,Holocene?,1631.000000000000000,Cinder cones,?,40.7798996,-121.6009979
554.000000000000000,1203-06-,Tumble Buttes,US-California,Holocene?,2191.000000000000000,Cinder cones,?,40.6799011,-121.5510025
555.000000000000000,1203-09-,Eagle Lake Field,US-California,Holocene?,1652.000000000000000,Fissure vents,?,40.6299019,-120.8310013
556.000000000000000,1203-08-,Lassen Volc Center,US-California,Historical,3187.000000000000000,Stratovolcano,D2,40.4919014,-121.5009995
557.000000000000000,1203-10-,Clear Lake,US-California,Holocene,1439.000000000000000,Volcanic field,U,38.9698982,-122.7710037
558.000000000000000,1206-01-,Steamboat Springs,US-Nevada,Pleistocene-Fumarolic,1415.000000000000000,Lava domes,Q,39.3749008,-119.7210007
560.000000000000000,1208-01-,Dotsero,US-Colorado,Radiocarbon,2230.000000000000000,Maar,D7,39.6500015,-107.0309982
561.000000000000000,1203-11-,Mono Lake Volc Field,US-California,Tephrochronology,2121.000000000000000,Cinder cones,D4,37.9999008,-119.0309982
562.000000000000000,1207-05-,Black Rock Desert,US-Utah,Radiocarbon,1800.000000000000000,Volcanic field,D6,38.9700012,-112.5009995
563.000000000000000,1203-12-,Mono Craters,US-California,Radiocarbon,2796.000000000000000,Lava domes,D6,37.8799019,-119.0009995
564.000000000000000,1203-13-,Inyo Craters,US-California,Radiocarbon,2629.000000000000000,Lava domes,D6,37.6918983,-119.0210037
565.000000000000000,1203-14-,Long Valley,US-California,Pleistocene-Fumarolic,3390.000000000000000,Caldera,Q,37.6999016,-118.8710022
566.000000000000000,1203-15-,Red Cones,US-California,Radiocarbon,2748.000000000000000,Cinder cones,D7,37.5798988,-119.0510025
568.000000000000000,1203-16-,Ubehebe Craters,US-California,Anthropology,752.000000000000000,Maars,D7,37.0199013,-117.4509964
569.000000000000000,1207-04-,Markagunt Plateau,US-Utah,Dendrochronology,2840.000000000000000,Volcanic field,D6,37.5800018,-112.6709976
570.000000000000000,1207-01-,Santa Clara,US-Utah,Holocene?,1465.000000000000000,Volcanic field,?,37.2570000,-113.6210022
571.000000000000000,1207-03-,Bald Knoll,US-Utah,Holocene,2135.000000000000000,Cinder cones,U,37.3279991,-112.4010010
572.000000000000000,1203-17-,Golden Trout Creek,US-California,Tephrochronology,2886.000000000000000,Volcanic field,D7,36.3578987,-118.3209991
574.000000000000000,1203-18-,Coso Volc Field,US-California,Holocene?,2400.000000000000000,Lava domes,?,36.0298996,-117.8209991
576.000000000000000,1209-01-,Uinkaret Field,US-Arizona,Anthropology,1555.000000000000000,Volcanic field,D6,36.3800011,-113.1309967
579.000000000000000,1203-19-,Lavic Lake,US-California,Holocene?,1495.000000000000000,Volcanic field,?,34.7500000,-116.6210022
580.000000000000000,1210-03-,Valles Caldera,US-New Mexico,Pleistocene-Fumarolic,3430.000000000000000,Caldera,Q,35.8699989,-106.5709991
581.000000000000000,1209-02-,Sunset Crater,US-Arizona,Dendrochronology,2447.000000000000000,Cinder cone,D6,35.3699989,-111.5009995
584.000000000000000,1203-20-,Amboy,US-California,Holocene,288.000000000000000,Cinder cone,U,34.5499992,-115.7809982
586.000000000000000,1210-02-,Zuni-Bandera,US-New Mexico,Anthropology,2550.000000000000000,Volcanic field,D7,34.7999992,-108.0009995
588.000000000000000,1210-01-,Carrizozo,US-New Mexico,Holocene,1731.000000000000000,Cinder cone,U,33.7801018,-105.9309998
import folium
import pandas
data = pandas.read_csv("Volcanoes.txt")
latitude = list(data["LAT"])
longitude = list(data["LON"])
name = list(data["NAME"])
elevation = list(data["ELEV"])
def volcano_height(x):
if x < 1000:
return "green"
elif x > 1000 and x < 3000:
return "orange"
else:
return "red"
map = folium.Map(location=[38.58, -99.09], zoom_start=6, tiles="Stamen Terrain")
fgv = folium.FeatureGroup(name="Volcanoes")
for lat, lon, el, n in zip(latitude, longitude, elevation, name):
fgv.add_child(folium.CircleMarker(location=[lat, lon], radius= 6, popup=str(n) + "\n" + str(el)+"m", fill_color=volcano_height(el), color = 'grey', fill_opacity=0.7))
fgp = folium.FeatureGroup(name="Population")
fgp.add_child(folium.GeoJson(data=open("world.json", 'r', encoding='utf-8-sig').read(),
style_function=lambda x: {'fillColor': 'green' if x['properties']['POP2005'] < 10000000
else 'orange' if 10000000 <= x['properties']['POP2005'] < 20000000 else 'red'}))
map.add_child(fgv)
map.add_child(fgp)
map.add_child(folium.LayerControl())
map.save("Map1.html")
This diff is collapsed.
{
"cells": [],
"metadata": {},
"nbformat": 4,