Skip to content

Instantly share code, notes, and snippets.

View johannah's full-sized avatar

Johanna Hansen johannah

View GitHub Profile
@johannah
johannah / mb-system-install-notes.md
Last active June 10, 2023 12:41
Instructions for Installing MB-System for Sonar processing

This is documentation for installing MB-System-r2279 on Ubuntu 14.04 as of Nov 2016. Although documentation for mb-system has improved dramatically over the past few years, it can still be difficult. In particular, I have not found step 1.4 in the documentation and missing this step will result in being unable to use gmt shared libraries such as "gmt mbcontour" which is necessary for producing contour lines in maps.

##1) Install GMT 5.1.2 I am using directions from Andrew at: http://andrewjmoodie.com/2014/12/installing-the-generic-mapping-tools-5-gmt-5-1-x-on-ubuntu-linux/ I've added step 1.4 to get this to load shared libraries from mb-system.

##1.1) Install relvent dependencies

@johannah
johannah / create_geotiff.py
Last active September 5, 2022 20:46
Helper file to create a geotiff from a given image or from an automatically downloaded satellite image from google maps which is centered around a given coordinate .
"""
BST License
# Description
File to create geotiffs depends on gdal installed on system. Can be used under two modes:
1) Download a satellite overview screenshot from google maps around a center
coordinate. Can give zoom (max is usually 20, but depends on area - will return
an image with error message if zoom is too high) and image size
(defaults to max 640x640)
2) Convert an existing image into a geotiff by giving UL and LR corner
# to get mujoco-py to install with headless rendering without sudo access
##############################
# 1) first download and install mujoco according to instructions from https://github.com/deepmind/mujoco/
##############################
# 2) add environment variables to your bashrc
# importantly, this should be done before installing mujoco-py
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/$USER/.mujoco/mujoco210/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/nvidia
'''
This script saves each topic in a bagfile as a csv.
Accepts a filename as an optional argument. Operates on all bagfiles in current directory if no argument provided
Originally Written by Nick Speal in May 2013 at McGill University's Aerospace Mechatronics Laboratory
Modified by J.Hansen in 2021
'''
import rosbag, sys, csv
@johannah
johannah / pain_model.py
Last active June 5, 2019 20:38
ai4good pain model example
import numpy as np
import os
import sys
# hours_per_time_step should be greater than 1
hours_per_step = 2
class PainModel():
def __init__(self, seed):
# pain -1 is bad
# from KK
from copy import deepcopy
import time
import os
import torch
import torch.nn as nn
from torch.nn.utils.clip_grad import clip_grad_norm
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import Variable
@johannah
johannah / sine_wave_rnn.py
Last active May 1, 2018 17:12
learning rnn sinewaves
# from KK
import torch
from torch.autograd import Variable
import numpy as np
import matplotlib.pyplot as plt
import torch.nn.init as init
from IPython import embed
dtype = torch.FloatTensor
input_size, hidden_size, output_size = 1,128,1
import os, sys
from glob import glob
from IPython import embed
from subprocess import call
# example <a href='catalog.html?dataset=NOAA/CBOFS/MODELS/201710/nos.cbofs.stations.nowcast.20171031.t18z.nc'><tt>nos.cbofs.stations.nowcast.20171031.t18z.nc</tt></a></td>^M
fpaths = glob('/localdata/jhansen/thredds/opendap.co-ops.nos.noaa.gov/thredds/catalog/NOAA/*')
output = '/localdata/jhansen/thredds/ncfiles'
fileServer = 'https://opendap.co-ops.nos.noaa.gov/thredds/fileServer/'
for station in fpaths:
# only get stations which have fairly open oceans
name: py-ros
channels:
- defaults
dependencies:
- backports=1.0=py27h63c9359_1
- backports.shutil_get_terminal_size=1.0.0=py27h5bc021e_2
- ca-certificates=2017.08.26=h1d4fec5_0
- certifi=2017.7.27.1=py27h9ceb091_0
- decorator=4.1.2=py27h1544723_0
- enum34=1.1.6=py27h99a27e9_1
import numpy
import time
import matplotlib.pyplot as plt
import numpy as np
from copy import deepcopy
import os, sys
from scipy.misc import face
import GPy
from skimage.transform import resize
from skimage.filters import gaussian_filter