Skip to content

Instantly share code, notes, and snippets.

View avishekrk's full-sized avatar

Avishek Kumar avishekrk

  • The University of Chicago
  • Chicago, IL
View GitHub Profile
newmapping_dict = {}
with open('modeled_interactions.dat','r') as infile:
for line in infile:
line = line.strip('\n')
print line
pdbid, sites = line.split(':')
print pdbid
print sites.split()
newmapping_dict[pdbid.upper()] = sites.split()
#!/usr/bin/env python
# coding: utf-8
"""
Summary Stats for Water Work Orders
Description
-----------
Python Script for producing figures and tables
for summary stats of Water Work Orders.
Figures are stored in **./figure** directory
and tables are stored in **./tables** directory.
@avishekrk
avishekrk / street_main.sql
Last active June 24, 2016 07:00
Map Streets and Main
drop table if exists public.main_street_map;
select ogc_fid, street_geom, name, type, globalid, water_geom, distance into public.main_street_map
from
(
select ogc_fid, street_geom, name, type, globalid, water_geom,distance,
row_number() over(partition by ogc_fid order by distance) rank from
(
select st_distance(s.wkb_geometry, m.wkb_geometry) distance,
s.ogc_fid,
s.wkb_geometry street_geom,
drop table if exists public.test_snap;
select st_closestpoint(wkb_geometry, geom) snapped_geom, geom, wkb_geometry, main_globalid, date, wrkid
into public.test_snap --call this something better then test_snap
from
(
select geom, wkb_geometry, globalid main_globalid, date, wrkid, row_number() over(partition by wrkid order by distance) rank
from
(
select st_distance(w.geom, m.wkb_geometry) distance, w.geom, m.wkb_geometry, m.globalid,
w.objectid wrkid, w.date
----------------------------------------------------
--This script does the following
-- -creates a proto type table
-- - creates a table for testing main to road snapping
-- - creates a table for static features
-- - need to map soil features
----------------------------------------------------
#YAML file containing the configuration
#of the models.
#DATE STARTS AT THE END OF THE YEAR E.G. DEC 31, 2013
features_table: 'features.combined'
break_window: '1Year'
static_features: ['diameters','pipe_age']
past_cols: ['wo_curr', 'wo_last1', 'wo_last2', 'wo_last3', 'wo_last4', 'wo_last5']
future_cols: ['wo_next1','wo_next2','wo_next3']
import time
time.time()
timestamp = time.time()
import datetime
print datetime.datetime.fromtimestamp(timestamp).strftime('%Y-%m-%d %H:%M:%S')
syracuse=> select model_id, model_name, precision_at_1, rebalancing from model.results_stats where model_name = 'LR' order by 3 desc;
model_id | model_name | precision_at_1 | rebalancing
-------------------+------------+-------------------+-------------------------------------------------------------------------------------
1471389247.579113 | LR | 0.528301886792453 | none
1471389270.931672 | LR | 0.509433962264151 | none
1471389258.090024 | LR | 0.490566037735849 | none
1471389218.293982 | LR | 0.490566037735849 | none
1471389232.568056 | LR | 0.452830188679245 | none
1471403347.084602 | LR | 0.194444444444444 | {"break": 0.20000000000000001, "n_points": 8820, "no_break": 0.80000000000000004}
1471403366.063143 | LR | 0.194444444444444 | {"break": 0.10000000000000001, "n_points": 17640, "no_break": 0.90000000000000002}
@avishekrk
avishekrk / clean.sh
Created May 31, 2018 10:03
Clean food inspections
!/bin/bash
wget https://github.com/avishekrk/where_not_to_eat/archive/master.zip;
unzip master.zip;
rm -v master.zip
mv -v where_not_to_eat-master raw
cd ./raw/
pwd
find -name "* *" | while read f; do echo ${f}; new=$(echo $f | sed "s/ /_/g"); echo ${new}; mv -v "$f" $new; done
mkdir -v ./../staging
head -1 food_inspection_2018-01-01.csv| tr '[:upper:]' '[:lower:]' | sed -e "s/#//g" -e "s/ ,/,/g" -e "s/ /_/g" -e s"/^,//g" > header
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.