This code sample has been consolidated/migrated to cgobat/pulsar-nulling/pulsar_diagram.py.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests, matplotlib.pyplot as plt, json | |
from PIL import Image | |
from bs4 import BeautifulSoup as bs | |
def NASA_img(query,num): | |
endpoint = "https://images-api.nasa.gov/search?q="+str(query).replace(" ","+") | |
response = requests.get(endpoint) | |
results = json.loads(response.content) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests, json | |
from bs4 import BeautifulSoup as bs | |
from pprint import pprint | |
# Retrieve info from web | |
page = requests.get('https://advising.columbian.gwu.edu/general-education-courses') | |
soup = bs(page.content, 'html.parser') | |
main_content = soup.find('div',{"id":"main_content"}) | |
# Generate a dictionary of GPAC categories and the courses that fall under them. Basically just converting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from mpl_toolkits.mplot3d import Axes3D | |
from matplotlib import cm, pyplot as plt | |
from scipy.special import sph_harm # (very convenient) | |
theta = np.linspace(0, 2*np.pi, 361) # define independent vars | |
phi = np.linspace(0, np.pi, 181) | |
THETA, PHI = np.meshgrid(theta, phi) # 2D versions of the independent variables | |
XYZ = np.array([np.sin(PHI) * np.sin(THETA), np.sin(PHI) * np.cos(THETA), np.cos(PHI)]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with open("randomstate.pkl","rb") as picklefile: | |
np.random.set_state(pickle.load(picklefile)) | |
N = 100 | |
trials = 50000 | |
theta = np.linspace(0,2*np.pi,360) | |
fractions = np.array([]) | |
for i in range(trials): | |
points = np.array([[2*x-1,2*y-1] for [x,y] in np.random.rand(N,2)]) | |
C = np.array([point for point in points if point[0]**2+point[1]**2 <= 1]) | |
fractions = np.append(fractions, len(C)/len(points)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
long cm; //goal distance | |
long target; //target # of pulses | |
volatile long pulses; //current # of pulses | |
long timer; //time elapsed since start | |
float conv = 10.208; //cm per 100 pulses | |
long gatecm = 900; //distance to run before slowing down | |
long gateTarget; //number of pulses the previous translates to | |
long dir; //current direction of motion | |
void setup() |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Expecting a Jupyter notebook here? Visit cgobat/pulsar-nulling/Nulling.ipynb for the most up-to-date version of this code.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
OlderNewer