Skip to content

Instantly share code, notes, and snippets.

View sametz's full-sized avatar

Geoffrey Sametz sametz

View GitHub Profile
@sametz
sametz / UDSIS_scrape_rosters.ipynb
Created February 13, 2023 20:56
A Jupyter notebook that can combine all class rosters in UDSIS to one .csv
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sametz
sametz / audita_parse.py
Created January 16, 2020 14:59
walks a directory looking for audita.txt NMR metadata and saves info as a csv
"""Walk a directory tree, find audita.txt metadata files for NMR experiments
of different peptides, parse their content and their location in the directory,
and record the data as a csv.
*** parent_folder needs to be changed to whatever parent folder you want to
search for NMR data.***
The tree structure resembles:
<parent directory>/<experiment>/<peptide>/<NMR experiment>/<audita.txt>
and it is assumed that files are stored in this structure, in order to parse
@sametz
sametz / jupyter-hidecode.ipynb
Last active July 22, 2019 14:34
Hide code in Jupyter notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sametz
sametz / braket.ipynb
Created June 9, 2018 17:38
Dirac notation (bra/ket) LaTeX commands for use in Jupyter notebooks
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sametz
sametz / pydnmr-web.py
Created November 1, 2017 20:20
Hacking a web app version of pydnmr, using plot.ly's Dash.
import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objs as go
import numpy as np
from testdata import TWOSPIN_SLOW
entry_names = ['va', 'vb', 'ka','wa', 'wb', 'pa']
entry_dict = {'va': 165,
@sametz
sametz / sys_settrace_call.py
Created October 22, 2017 18:33
Tracing Function Calls (from PyMOTW: https://pymotw.com/2/sys/tracing.html)
#!/usr/bin/env python
# encoding: utf-8
import sys
def trace_calls(frame, event, arg):
if event != 'call':
return
co = frame.f_code
func_name = co.co_name
@sametz
sametz / cleancanvas.py
Created June 13, 2017 21:02
quick and dirty hack for cleaning up grade rosters exported by Canvas.
"""
This notebook assumes that the .csv file has columns, with headings renamed as
below, for:
* Section (contents unedited from the Canvas default)
* Final exam (final exam score /100)
* Lab Reports (total lab report score /100)
* Quizzes (total quiz score /100)
* Total (Total score /100)
It assumes that, if not given a specific csv filename for conversion,
@sametz
sametz / parents.py
Created March 28, 2017 01:10
Determine list of parents of a PyQt5 object
def test_child_parent_map(self):
va_widget_fetch = self.ui.findChild(QDoubleSpinBox, 'va') # look up a widget by objectName
current_widget = va_widget_fetch
end = False
while not end:
try:
print('Widget ', current_widget.objectName(), ' has parent ',
current_widget.parent().objectName())
current_widget = current_widget.parent()
except: