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
@mikofski
mikofski / iam_fresnel_ar.py
Created July 22, 2022 23:50
Fresnel with AR coating
"""
Approximately duplicates plot on this pvsyst help here:
https://www.pvsyst.com/help/iam_loss.htm
"""
import numpy as np
import matplotlib.pyplot as plt
plt.ion()
@mikofski
mikofski / django_service.py
Last active May 31, 2022 02:05
Start a Windows service to run the Django debug server - WARNING! not recommended for deployment!
#!/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.
@mikofski
mikofski / cython_optimize_brentq_benchmark.ipynb
Last active March 11, 2022 21:34
SciPy Cython Optimize Zeros API
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mikofski
mikofski / timeseries.py
Last active February 15, 2022 05:55
time series examples that subclass numpy ndarray
#! /usr/bin/env python
import numpy as np
from datetime import datetime, time, timedelta
import pytz
class Timeseries(object):
def __init__(self, x, t):
self.x = np.array(x)
self.t = np.array(t,dtype='datetime64[s]')
@mikofski
mikofski / AOC21.ipynb
Last active December 9, 2021 07:54
Advent of Code 2021
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mikofski
mikofski / EXTRACT_BOKEH_DATA.md
Last active May 7, 2021 06:14
extract bokeh data

Binder

@mikofski
mikofski / polyfitZero.m
Last active April 30, 2021 05:15
fit (x,y) to polynomial of degree (degree) forcing y-intercept to zero
function [p,S,mu] = polyfitZero(x,y,degree)
% POLYFITZERO Fit polynomial to data, forcing y-intercept to zero.
% P = POLYFITZERO(X,Y,N) is similar POLYFIT(X,Y,N) except that the
% y-intercept is forced to zero, i.e. P(N) = 0. In the same way as
% POLYFIT, the coefficients, P(1:N-1), fit the data Y best in the least-
% squares sense. You can also use Y = POLYVAL(PZERO,X) to evaluate the
% polynomial because the output is the same as POLYFIT.
%
% [P,S,MU] = POLYFITZERO() Return structure, S, similar to POLYFIT for use
% with POLYVAL to calculate error estimates of predictions with P.
@mikofski
mikofski / surfrad_data_download.py
Last active January 30, 2021 07:22
SURFRAD data download
#! python
import ftplib
import io
import json
import logging
import pathlib
import sys
import threading
import time
@mikofski
mikofski / spectral_mismatch.ipynb
Last active January 7, 2021 17:42
spectral mismatch
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import os
import pvlib
import pandas as pd
from matplotlib import pyplot as plt
import seaborn as sns
sns.set()
plt.ion()
INVERTERS = pvlib.pvsystem.retrieve_sam('CECInverter')
INVERTER_10K = INVERTERS['SMA_America__SB10000TL_US__240V_']