Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pathlib import Path | |
import requests | |
import pandas as pd | |
from tqdm import tqdm | |
def get_locations(base_url: str = "https://api.luchtmeetnet.nl/open_api/stations"): | |
"""Get all locations from the LML API. | |
Parameters: | |
----------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from osgeo import ogr | |
import pandas as pd | |
import geopandas as gpd | |
def get_data(file): | |
ds = ogr.Open(file) | |
result = list() | |
for lyr in ds: | |
for feat in lyr: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
class HiddenPrints: | |
def __enter__(self): | |
self._original_stdout = sys.stdout | |
sys.stdout = open(os.devnull, 'w') | |
def __exit__(self, exc_type, exc_val, exc_tb): | |
sys.stdout.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, smtplib | |
from os.path import basename | |
from email.mime.application import MIMEApplication | |
from email.mime.multipart import MIMEMultipart | |
from email.mime.text import MIMEText | |
from email.utils import COMMASPACE, formatdate | |
def send_mail( | |
send_from="bruingjde@liacs.leidenuniv.nl", | |
send_to: list = ["gerritjan.debruin@gmail.com"], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in 'lightlevel' 'lumi_lumi' 'multisensor' 'rwl021' 'batterij' 'verbinding' 'herstart' 'notificatie' 'oplader' 'tradfri' 'water' 'wifi_signal' 'relais' 'on_off' | |
do | |
influx -host xxx -username homeassistant -password xxx -port 8086 --execute 'show measurements' --database=homeassistant | grep $i | xargs -I{} influx -host xxx -username homeassistant -password xxx -port 8086 --execute 'drop measurement "{}"' --database=homeassistant | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Define research questions: https://tex.stackexchange.com/questions/525921/ideas-for-presenting-the-research-question | |
\usepackage{enumitem} | |
\newlist{questions}{enumerate}{2} | |
\setlist[questions,1]{wide=0pt,leftmargin=\parindent,label=RQ\arabic*.,ref=RQ\arabic*} | |
\setlist[questions,2]{label=(\alph*),ref=\thequestionsi(\alph*)} | |
% In document | |
\begin{questions} | |
\item \label{rq:events} How should event-based links, which may re-occur over time, be dealt with in order to accurately predict future links? | |
\item \label{rq:availability} To what extent does the availability of temporal information improve the performance of link prediction approaches? |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html = hip.Experiment.from_iterable(df.to_dict(orient='records')).to_html() | |
soup = BeautifulSoup(html, 'html.parser') | |
tag1 = soup.new_tag('div', attrs={'margin-left': 'auto', 'margin-right': 'auto'}) | |
tag1.append(BeautifulSoup(fig1.to_html(include_plotlyjs='cdn', full_html=False))) | |
soup.body.insert(0, tag1) | |
tag2 = soup.new_tag('div', attrs={'margin-left': 'auto', 'margin-right': 'auto'}) | |
tag2.append(BeautifulSoup(fig2.to_html(include_plotlyjs='cdn', full_html=False))) | |
soup.body.insert(1, tag2) | |
with open('docs/run3.html', 'w') as file: | |
file.write(str(soup)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import joblib | |
from tqdm.auto import tqdm | |
class ProgressParallel(joblib.Parallel): | |
def __init__(self, use_tqdm=True, total=None, desc=None, *args, **kwargs): | |
self._use_tqdm = use_tqdm | |
self._total = total | |
self._desc = desc | |
super().__init__(*args, **kwargs) |
NewerOlder