This file contains hidden or 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 os | |
| import cPickle as pickle | |
| import matplotlib.pyplot as plt | |
| import ads | |
| max_retries = 5 | |
| N_top_papers = 1000 |
This file contains hidden or 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
| """ | |
| Retrieve all articles authored by ANU RSAA researchers in the previous month. | |
| """ | |
| __author__ = 'Andy Casey <arc@ast.cam.ac.uk>' | |
| # You will also need PyPDF2 (use `pip install pypdf2`) for this example in order | |
| # to manipulate PDFs. | |
| # Example usage: python stromlo.py (to run previous month) |
This file contains hidden or 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 astropy.table import Table | |
| import thecannon as tc | |
| # The Ness et al. (2015) data is accessible from [URL] | |
| labelled_set = Table.read("Ness_2015_labelled.csv") | |
| normalized_flux = np.memmap("Ness_2015_normalized_flux.memmap", | |
| mode="r", dtype=float) | |
| normalized_ivar = np.memmap("Ness_2015_normalized_ivar.memmap", |
This file contains hidden or 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
| In [30]: ok = image[1].data["physical"] | |
| In [31]: elements = [_ for _ in image[1].data.dtype.names if _.endswith("_H") and _ not in ("SRC_H", "PARAM_M_H")] | |
| In [32]: for element in elements: | |
| print(element, np.sum(np.isfinite(image[1].data[element][ok]))) | |
| ....: | |
| ('AL_H', 99127) | |
| ('CA_H', 99127) | |
| ('C_H', 99127) |
This file contains hidden or 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 os | |
| import numpy as np | |
| from astropy.table import Table | |
| from astropy.io import fits | |
| import AnniesLasso as tc | |
| training_set_path = "example_DR10/reference_labels.csv" |
This file contains hidden or 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 | |
| def distance_to_nearest_major_city(database, postcodes, | |
| major_city_postcodes=None): | |
| """ | |
| Calculate the estimate distance between a postcode and the nearest major | |
| city. |
This file contains hidden or 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
| # Script to monitor and restart wireless access point when needed | |
| maxPloss=10 #Maximum percent packet loss before a restart | |
| restart_networking() { | |
| # Add any commands need to get network back up and running | |
| /etc/init.d/networking restart | |
| #only needed if your running a wireless ap |
This file contains hidden or 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
| wget https://data.sdss.org/sas/dr14/apogee/spectro/redux/r8/stars/l31c/l31c.2/cannon/allStarCannon-l31c.2.fits | |
| wget https://data.sdss.org/sas/dr14/apogee/spectro/redux/r8/stars/l31c/l31c.2/allStar-l31c.2.fits |
This file contains hidden or 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 scipy.spatial import Delaunay | |
| training_set_labels = #.... from somewhere else | |
| test_set_labels = np.atleast_2d(test_set_labels) | |
| # construct convex hull of the training set using all labels | |
| hull = Delaunay(training_set_labels) |
This file contains hidden or 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 astroquery.gaia import Gaia | |
| import matplotlib.pyplot as plt | |
| def astrometry_covariance_matrix(source): | |
| """ | |
| Construct a covariance matrix for a 5-parameter astrometric solution | |
| measured by Gaia for a single source. |