Skip to content

Instantly share code, notes, and snippets.

View mikofski's full-sized avatar
😎
Solving solar

Mark Mikofski mikofski

😎
Solving solar
View GitHub Profile
from scipy.stats import norm, uniform, gamma
from matplotlib.pyplot import rc, rcdefaults, subplots, imread, show
from matplotlib.lines import Line2D
from matplotlib.ticker import MultipleLocator
from matplotlib.transforms import blended_transform_factory
from matplotlib.offsetbox import VPacker, TextArea, AnchoredOffsetbox, DrawingArea
from matplotlib.image import BboxImage
from numpy.random import default_rng
@kandersolar
kandersolar / pvfactors_vs_infinitesheds.ipynb
Last active May 28, 2022 21:24
Comparison of front- and rear-side irradiance between pvfactors and DNV's infinite sheds model
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kandersolar
kandersolar / ground-sky-vf.ipynb
Last active December 30, 2021 01:22
Calculating sky dome vf for a point on the ground in an infinite sheds array. See https://nbviewer.org/gist/kanderso-nrel/68176ccd617851dfa26623452681fbeb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tvaught
tvaught / sir.py
Created March 30, 2020 01:55
SEIR Model in Python using Bokeh for Visualization
# Simple SEIR model
# by: Travis N. Vaught
#
# This is a bokeh version of the model shown here:
# https://scipython.com/book/chapter-8-scipy/additional-examples/the-sir-epidemic-model/
# and here:
# https://towardsdatascience.com/social-distancing-to-slow-the-coronavirus-768292f04296
#
# Dependencies:
# numpy, scipy, bokeh
@shoyer
shoyer / scipy-vs-numba-interp1d.ipynb
Last active September 18, 2019 08:05
scipy vs numba interp1d.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@teoliphant
teoliphant / simple_interpolation.py
Last active April 16, 2023 09:30
Vectorized linear interpolation
# The kernel function is
# roughtly equivalent to new[:] = np.interp(xnew, xvals, yvals)
# But this is broadcast so that it can be run many, many times
# quickly.
# Call using ynew = interp1d(xnew, xdata, ydata)
# ynew.shape will be xnew.shape
# Also, ydata.shape[-1] must be xdata.shape[-1]
# and if ydata or xdata have ndim greater than 1, the initial dimensions
# must be xnew.shape:
@mikofski
mikofski / release_robot.py
Last active April 5, 2017 22:39
gets sorted list of latest git tags - part of dulwich.contrib see PR #462 and #489
"""Determine last version string from tags.
Alternate to `Versioneer <https://pypi.python.org/pypi/versioneer/>`_ using
`Dulwich <https://pypi.python.org/pypi/dulwich>`_ to sort tags by time from
newest to oldest.
Copy the following into the package ``__init__.py`` module::
from dulwich.contrib.release_robot import get_current_version
__version__ = get_current_version('..')
@mikofski
mikofski / memcached_service.py
Created August 26, 2014 16:54
memcached service for windows
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Attribution: Hijacked from tracservice.py by Florent Xicluna <laxyf@yahoo.fr>
# http://trac-hacks.org/wiki/WindowsServiceScript
#
# To use this class, users must do the following:
# 1. Download and install the PyWin32all package
# (http://starship.python.net/crew/mhammond/win32/)
# 2. Edit the constants section with the proper information.
@brenopolanski
brenopolanski / merge-pdf-ghostscript.md
Last active May 2, 2024 06:56
Merge multiple PDFs using Ghostscript

A simple Ghostscript command to merge two PDFs in a single file is shown below:

gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=combine.pdf -dBATCH 1.pdf 2.pdf

Install Ghostscript:

Type the command sudo apt-get install ghostscript to download and install the ghostscript package and all of the packages it depends on.

@rmcgibbo
rmcgibbo / install.md
Last active October 14, 2021 00:17
Scientific Python From Source, with MKL

Scientific Python From Source

This document will walk you through compiling your own scientific python distribution from source, without sudo, on a linux machine. The core numpy and scipy libraries will be linked against Intel MKL for maximum performance.

This procedure has been tested with Rocks Cluster Linux 6.0 (Mamba) and CentOS 6.3.

Compiling Python From Source