Skip to content

Instantly share code, notes, and snippets.

View sebhoerl's full-sized avatar

Sebastian Hörl sebhoerl

  • IRT SystemX
  • Paris
View GitHub Profile
@sebhoerl
sebhoerl / moco.md
Last active April 19, 2025 08:06
Mobility coins

Mobility coins in eqasim

To run a mobility coins simulation, you need:

  • A recent MATSim / eqasim simulation case. You may use the latest one for Paris / Île-de-France or Munich / Bavaria. You should have the relevant files (network, population, ...) and a config.xml.
  • You need to build the code in the tum-moco repository.
  • Using the generated JAR, you can run a simulation.

Building

@sebhoerl
sebhoerl / compare.py
Created February 15, 2022 12:58
Compare HTS vs census
import matplotlib.pyplot as plt
import matplotlib.ticker as tck
import numpy as np
import pandas as pd
%matplotlib inline
for name in ("lyon", "nantes"):
plt.figure(figsize = (6, 3), dpi = 120)
df = pd.read_csv("/home/shoerl/lead/scenario_data/output_{}/debug_sc_without_fix.csv".format(name), sep = ";")
@sebhoerl
sebhoerl / create_poly.py
Created November 4, 2021 07:41
Create osmosis *.poly file using geopandas
import geopandas as gpd
def write_poly(df, path, geometry_column = "geometry"):
df = df.to_crs("EPSG:4326")
df["aggregate"] = 0
area = df.dissolve(by = "aggregate")[geometry_column].values[0]
if not hasattr(area, "exterior"):
print("Selected area is not connected -> Using convex hull.")
@sebhoerl
sebhoerl / episim_config.xml
Created April 9, 2020 10:59
Covid MATSim IVT
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE config SYSTEM "http://www.matsim.org/files/dtd/config_v2.dtd">
<config>
<module name="plans">
<param name="inputPlansFile" value="data/output_plans.xml.gz" />
</module>
<module name="episim" >
<param name="inputEventsFile" value="data/covid_events.xml.gz" />
<param name="outputEventsFolder" value="output" />
@sebhoerl
sebhoerl / RunEmissions.java
Created November 26, 2019 16:42
Emissions for MATSim
package org.eqasim.ile_de_france;
import org.matsim.api.core.v01.Id;
import org.matsim.api.core.v01.Scenario;
import org.matsim.api.core.v01.network.Link;
import org.matsim.api.core.v01.population.Person;
import org.matsim.contrib.emissions.EmissionModule;
import org.matsim.contrib.emissions.utils.EmissionsConfigGroup;
import org.matsim.contrib.emissions.utils.EmissionsConfigGroup.HbefaRoadTypeSource;
import org.matsim.contrib.emissions.utils.EmissionsConfigGroup.NonScenarioVehicles;
@sebhoerl
sebhoerl / count.sh
Created July 25, 2017 10:48
Word counter
#!/bin/sh
# Use pdftotext to get word count (including references)
mkdir -p _wc
pdftotext TRB.pdf _wc/text.txt
word_count=$(cat _wc/text.txt | wc -w)
rm -r _wc
echo "\newcommand{\mytextwordcount}{$word_count}%" > mywordcount.tex
@sebhoerl
sebhoerl / main.cpp
Last active October 6, 2015 14:52
Screen Capture
#include <gtkmm.h>
#include <X11/Xlib.h>
// g++ -o main main.cpp `pkg-config --cflags --libs gtk+-3.0 gtkmm-3.0 x11`
class MyWindow : public Gtk::Window {
protected:
Gtk::DrawingArea mArea;
Glib::RefPtr<Gdk::Screen> mGdkScreen;
#include <iterator>
#include <string>
#include <iostream>
#include <sstream>
using namespace std;
void ignore_until(istream& is, const string& delim) {
string data;
char c;
@sebhoerl
sebhoerl / gist:5138036
Last active December 14, 2015 19:39 — forked from anonymous/gist:5138020
function sprache2()
T25 = 1:10;
YEARS = 25;
DISTANCE = 18;
coordinates = [0 0];
for t = T25
rows = size(coordinates, 1);
new_coordinates = [];
for i = 1:rows
for j = 1:round(rand()*3)+1
x = (rand() - rand()) * DISTANCE;
y = sqrt(DISTANCE * DISTANCE - x * x) * sign(rand() - rand());
new_coordinates = [new_coordinates ; coordinates(i,:) + [x y]];
end
end