Search is not available for this dataset
text
stringlengths
75
104k
def delete_columns(self, columns): """ Delete columns from the DataFrame :param columns: list of columns to delete :return: nothing """ columns = [columns] if not isinstance(columns, (list, blist)) else columns if not all([x in self._columns for x in columns]): ...
def sort_index(self): """ Sort the DataFrame by the index. The sort modifies the DataFrame inplace :return: nothing """ sort = sorted_list_indexes(self._index) # sort index self._index = blist([self._index[x] for x in sort]) if self._blist else [self._index[x] fo...
def sort_columns(self, column, key=None, reverse=False): """ Sort the DataFrame by one of the columns. The sort modifies the DataFrame inplace. The key and reverse parameters have the same meaning as for the built-in sort() function. :param column: column name to use for the sort ...
def validate_integrity(self): """ Validate the integrity of the DataFrame. This checks that the indexes, column names and internal data are not corrupted. Will raise an error if there is a problem. :return: nothing """ self._validate_columns(self._columns) self._...
def append(self, data_frame): """ Append another DataFrame to this DataFrame. If the new data_frame has columns that are not in the current DataFrame then new columns will be created. All of the indexes in the data_frame must be different from the current indexes or will raise an error. ...
def add(self, left_column, right_column, indexes=None): """ Math helper method that adds element-wise two columns. If indexes are not None then will only perform the math on that sub-set of the columns. :param left_column: first column name :param right_column: second column nam...
def isin(self, column, compare_list): """ Returns a boolean list where each elements is whether that element in the column is in the compare_list. :param column: single column name, does not work for multiple columns :param compare_list: list of items to compare to :return: list...
def iterrows(self, index=True): """ Iterates over DataFrame rows as dictionary of the values. The index will be included. :param index: if True include the index in the results :return: dictionary """ for i in range(len(self._index)): row = {self._index_name:...
def itertuples(self, index=True, name='Raccoon'): """ Iterates over DataFrame rows as tuple of the values. :param index: if True then include the index :param name: name of the namedtuple :return: namedtuple """ fields = [self._index_name] if index else list() ...
def reset_index(self, drop=False): """ Resets the index of the DataFrame to simple integer list and the index name to 'index'. If drop is True then the existing index is dropped, if drop is False then the current index is made a column in the DataFrame with the index name the name of the...
def from_json(cls, json_string): """ Creates and return a DataFrame from a JSON of the type created by to_json :param json_string: JSON :return: DataFrame """ input_dict = json.loads(json_string) # convert index to tuple if required if input_dict['index']...
def doTask(self, task): """Filter input *task* to pipelines -- make sure each one has no more than *max_tasks* tasks in it. Return a tuple (*task*, *results*) where *task* is the given task, and *results* is a list of latest retrieved results from pipelines.""" # If w...
def assert_frame_equal(left, right, data_function=None, data_args=None): """ For unit testing equality of two DataFrames. :param left: first DataFrame :param right: second DataFrame :param data_function: if provided will use this function to assert compare the df.data :param data_args: argument...
def assert_series_equal(left, right, data_function=None, data_args=None): """ For unit testing equality of two Series. :param left: first Series :param right: second Series :param data_function: if provided will use this function to assert compare the df.data :param data_args: arguments to pass...
def get(self, timeout=None): """Return result from the pipeline.""" result = None for stage in self._output_stages: result = stage.get(timeout) return result
def main(): """ Run the CLI. """ parser = argparse.ArgumentParser( description='Search artists, lyrics, and songs!' ) parser.add_argument( 'artist', help='Specify an artist name (Default: Taylor Swift)', default='Taylor Swift', nargs='?', ) parser....
def load(self): """Load the lyrics from MetroLyrics.""" page = requests.get(self._url) # Forces utf-8 to prevent character mangling page.encoding = 'utf-8' tree = html.fromstring(page.text) lyric_div = tree.get_element_by_id('lyrics-body-text') verses = [c.text_c...
def load(self, verbose=False): """ Load the list of songs. Note that this only loads a list of songs that this artist was the main artist of. If they were only featured in the song, that song won't be listed here. There is a list on the artist page for that, I just hav...
def distance(p0, p1, deg=True, r=r_earth_mean): """ Return the distance between two points on the surface of the Earth. Parameters ---------- p0 : point-like (or array of point-like) [longitude, latitude] objects p1 : point-like (or array of point-like) [longitude, latitude] objects deg : b...
def course(p0, p1, deg=True, bearing=False): """ Compute the initial bearing along the great circle from p0 to p1 NB: The angle returned by course() is not the traditional definition of bearing. It is definted such that 0 degrees to due East increasing counter-clockwise such that 90 degrees is due ...
def propagate(p0, angle, d, deg=True, bearing=False, r=r_earth_mean): """ Given an initial point and angle, move distance d along the surface Parameters ---------- p0 : point-like (or array of point-like) [lon, lat] objects angle : float (or array of float) bearing. Note that by default...
def validate(self, signature, timestamp, nonce): """Validate request signature. :param signature: A string signature parameter sent by weixin. :param timestamp: A int timestamp parameter sent by weixin. :param nonce: A int nonce parameter sent by weixin. """ if not self....
def parse(self, content): """Parse xml body sent by weixin. :param content: A text of xml body. """ raw = {} try: root = etree.fromstring(content) except SyntaxError as e: raise ValueError(*e.args) for child in root: raw[chil...
def reply(self, username, type='text', sender=None, **kwargs): """Create the reply text for weixin. The reply varies per reply type. The acceptable types are `text`, `music`, `news`, `image`, `voice`, `video`. Each type accepts different parameters, but they share some common parameters...
def register(self, key=None, func=None, **kwargs): """Register a command helper function. You can register the function:: def print_help(**kwargs): username = kwargs.get('sender') sender = kwargs.get('receiver') return weixin.reply( ...
def view_func(self): """Default view function for Flask app. This is a simple implementation for view func, you can add it to your Flask app:: weixin = Weixin(app) app.add_url_rule('/', view_func=weixin.view_func) """ if request is None: rais...
def run_getgist(filename, user, **kwargs): """Passes user inputs to GetGist() and calls get()""" assume_yes = kwargs.get("yes_to_all") getgist = GetGist(user=user, filename=filename, assume_yes=assume_yes) getgist.get()
def run_getmy(filename, **kwargs): """Shortcut for run_getgist() reading username from env var""" assume_yes = kwargs.get("yes_to_all") user = getenv("GETGIST_USER") getgist = GetGist(user=user, filename=filename, assume_yes=assume_yes) getgist.get()
def run_putgist(filename, user, **kwargs): """Passes user inputs to GetGist() and calls put()""" assume_yes = kwargs.get("yes_to_all") private = kwargs.get("private") getgist = GetGist( user=user, filename=filename, assume_yes=assume_yes, create_private=private, a...
def get(self): """Reads the remote file from Gist and save it locally""" if self.gist: content = self.github.read_gist_file(self.gist) self.local.save(content)
def put(self): """ Reads local file & update the remote gist (or create a new one)""" content = self.local.read() if self.gist: self.github.update(self.gist, content) else: self.github.create(content, public=self.public)
def oauth_only(function): """Decorator to restrict some GitHubTools methods to run only with OAuth""" def check_for_oauth(self, *args, **kwargs): """ Returns False if GitHubTools instance is not authenticated, or return the decorated fucntion if it is. """ if not self.is...
def add_oauth_header(self): """ Validate token and add the proper header for further requests. :return: (None) """ # abort if no token oauth_token = self._get_token() if not oauth_token: return # add oauth header & reach the api self.h...
def get_gists(self): """ List generator containing gist relevant information such as id, description, filenames and raw URL (dict). """ # fetch all gists if self.is_authenticated: url = self._api_url("gists") else: url = self._api_url("user...
def select_gist(self, allow_none=False): """ Given the requested filename, it selects the proper gist; if more than one gist is found with the given filename, user is asked to choose. :allow_none: (bool) for `getgist` it should raise error if no gist is found, but setting this ar...
def read_gist_file(self, gist): """ Returns the contents of file hosted inside a gist at GitHub. :param gist: (dict) gist parsed by GitHubTools._parse() :return: (bytes) content of a gist loaded from GitHub """ url = False files = gist.get("files") for gis...
def update(self, gist, content): """ Updates the contents of file hosted inside a gist at GitHub. :param gist: (dict) gist parsed by GitHubTools._parse_gist() :param content: (str or bytes) to be written :return: (bool) indicatind the success or failure of the update """ ...
def create(self, content, **kwargs): """ Create a new gist. :param gist: (dict) gist parsed by GitHubTools._parse() :param content: (str or bytes) to be written :param public: (bool) defines if the gist is public or private :return: (bool) indicatind the success or failur...
def _ask_which_gist(self, matches): """ Asks user which gist to use in case of more than one gist matching the instance filename. :param matches: (list) of dictioaries generated within select_gists() :return: (dict) of the selected gist """ # ask user which gist t...
def _parse_gist(gist): """Receive a gist (dict) and parse it to GetGist""" # parse files files = list() file_names = sorted(filename for filename in gist["files"].keys()) for name in file_names: files.append( dict(filename=name, raw_url=gist["files"][...
def indent(self, message): """ Sets the indent for standardized output :param message: (str) :return: (str) """ indent = self.indent_char * self.indent_size return indent + message
def output(self, message, color=None): """ A helper to used like print() or click's secho() tunneling all the outputs to sys.stdout or sys.stderr :param message: (str) :param color: (str) check click.secho() documentation :return: (None) prints to sys.stdout or sys.stderr...
def get(self, url, params=None, **kwargs): """Encapsulte requests.get to use this class instance header""" return requests.get(url, params=params, headers=self.add_headers(**kwargs))
def patch(self, url, data=None, **kwargs): """Encapsulte requests.patch to use this class instance header""" return requests.patch(url, data=data, headers=self.add_headers(**kwargs))
def post(self, url, data=None, **kwargs): """Encapsulte requests.post to use this class instance header""" return requests.post(url, data=data, headers=self.add_headers(**kwargs))
def save(self, content): """ Save any given content to the instance file. :param content: (str or bytes) :return: (None) """ # backup existing file if needed if os.path.exists(self.file_path) and not self.assume_yes: message = "Overwrite existing {}? (...
def backup(self): """Backups files with the same name of the instance filename""" count = 0 name = "{}.bkp".format(self.filename) backup = os.path.join(self.cwd, name) while os.path.exists(backup): count += 1 name = "{}.bkp{}".format(self.filename, count) ...
def read(self, file_path=None): """ Read the contents of a file. :param filename: (str) path to a file in the local file system :return: (str) contents of the file, or (False) if not found/not file """ if not file_path: file_path = self.file_path # ab...
def char_matcher(mode): """ a faster way for characters to generate token strings cache """ def f_raw(inp_str, pos): return mode if inp_str[pos] is mode else None def f_collection(inp_str, pos): ch = inp_str[pos] for each in mode: if ch is each: ...
def str_matcher(mode): """ generate token strings' cache """ def f_raw(inp_str, pos): return unique_literal_cache_pool[mode] if inp_str.startswith(mode, pos) else None def f_collection(inp_str, pos): for each in mode: if inp_str.startswith(each, pos): ...
def regex_matcher(regex_pat): """ generate token names' cache :param regex_pat: :return: """ if isinstance(regex_pat, str): regex_pat = re.compile(regex_pat) def f(inp_str, pos): m = regex_pat.match(inp_str, pos) return m.group() if m else None retu...
def ast_for_stmts(self, stmts: T) -> None: """ Stmts ::= TokenDef{0, 1} Equals*; """ if not stmts: raise ValueError('no ast found!') head, *equals = stmts if head.name is NameEnum.TokenDef: self.ast_for_token_def(head) elif he...
def _request(self, method, resource_uri, **kwargs): """Perform a method on a resource. Args: method: requests.`method` resource_uri: resource endpoint Raises: HTTPError Returns: JSON Response """ data = kwargs.get('data') ...
def get(self, endpoint, **kwargs): """Get a resource. Args: endpoint: resource endpoint. """ return self._request(requests.get, endpoint, **kwargs)
def post(self, endpoint, **kwargs): """Create a resource. Args: endpoint: resource endpoint. """ return self._request(requests.post, endpoint, **kwargs)
def put(self, endpoint, **kwargs): """Update a resource. Args: endpoint: resource endpoint. """ return self._request(requests.put, endpoint, **kwargs)
def update(cls, customer_id, **kwargs): """ Static method defined to update paystack customer data by id. Args: customer_id: paystack customer id. first_name: customer's first name(optional). last_name: customer's last name(optional). email: custo...
def render(txt): """ Accepts Slack formatted text and returns HTML. """ # Removing links to other channels txt = re.sub(r'<#[^\|]*\|(.*)>', r'#\g<1>', txt) # Removing links to other users txt = re.sub(r'<(@.*)>', r'\g<1>', txt) # handle named hyperlinks txt = re.sub(r'<([^\|]*)\|(...
def _open_list(self, list_type): """ Add an open list tag corresponding to the specification in the parser's LIST_TYPES. """ if list_type in LIST_TYPES.keys(): tag = LIST_TYPES[list_type] else: raise Exception('CustomSlackdownHTMLParser:_open_list:...
def _close_list(self): """ Add an close list tag corresponding to the currently open list found in current_parent_element. """ list_type = self.current_parent_element['attrs']['class'] tag = LIST_TYPES[list_type] html = '</{t}>'.format( t=tag ...
def handle_starttag(self, tag, attrs): """ Called by HTMLParser.feed when a start tag is found. """ # Parse the tag attributes attrs_dict = dict(t for t in attrs) # If the tag is a predefined parent element if tag in PARENT_ELEMENTS: # If parser is pa...
def handle_endtag(self, tag): """ Called by HTMLParser.feed when an end tag is found. """ if tag in PARENT_ELEMENTS: self.current_parent_element['tag'] = '' self.current_parent_element['attrs'] = '' if tag == 'li': self.parsing_li = True ...
def handle_data(self, data): """ Called by HTMLParser.feed when text is found. """ if self.current_parent_element['tag'] == '': self.cleaned_html += '<p>' self.current_parent_element['tag'] = 'p' self.cleaned_html += data
def _remove_pre_formatting(self): """ Removes formatting tags added to pre elements. """ preformatted_wrappers = [ 'pre', 'code' ] for wrapper in preformatted_wrappers: for formatter in FORMATTERS: tag = FORMATTERS[form...
def clean(self): """ Goes through the txt input and cleans up any problematic HTML. """ # Calls handle_starttag, handle_endtag, and handle_data self.feed() # Clean up any parent tags left open if self.current_parent_element['tag'] != '': self.cleaned_...
def render_author(**kwargs): """ Unstrict template block for rendering authors: <div class="author"> <img class="author-avatar" src="{author_avatar}"> <p class="author-name"> <a href="{author_link}">{author_name}</a> </p> <p class="user-handle">{author_handle}</p>...
def render_metadata(**kwargs): """ Unstrict template block for rendering metadata: <div class="metadata"> <img class="metadata-logo" src="{service_logo}"> <p class="metadata-name">{service_name}</p> <p class="metadata-timestamp"> <a href="{timestamp_link}">{timestamp}</a>...
def render_image(**kwargs): """ Unstrict template block for rendering an image: <img alt="{alt_text}" title="{title}" src="{url}"> """ html = '' url = kwargs.get('url', None) if url: html = '<img' alt_text = kwargs.get('alt_text', None) if alt_text: html...
def render_twitter(text, **kwargs): """ Strict template block for rendering twitter embeds. """ author = render_author(**kwargs['author']) metadata = render_metadata(**kwargs['metadata']) image = render_image(**kwargs['image']) html = """ <div class="attachment attachment-twitter"> ...
def get_model(LAB_DIR): """ Cannon model params """ coeffs = np.load("%s/coeffs.npz" %LAB_DIR)['arr_0'] scatters = np.load("%s/scatters.npz" %LAB_DIR)['arr_0'] chisqs = np.load("%s/chisqs.npz" %LAB_DIR)['arr_0'] pivots = np.load("%s/pivots.npz" %LAB_DIR)['arr_0'] return coeffs, scatters, chisqs,...
def get_labels(ids_find): """ Labels to make Cannon model spectra """ a = pyfits.open("%s/lamost_catalog_full.fits" %LAB_DIR) data = a[1].data a.close() id_all = data['lamost_id'] id_all = np.array(id_all) id_all = np.array([val.strip() for val in id_all]) snr_all = data['cannon_snrg'] ...
def get_normed_spectra(): """ Spectra to compare with models """ wl = np.load("%s/wl.npz" %LAB_DIR)['arr_0'] filenames = np.array( [SPEC_DIR + "/Spectra" + "/" + val for val in lamost_id]) grid, fluxes, ivars, npix, SNRs = lamost.load_spectra( lamost_id, input_grid=wl) ds = d...
def wget_files(): """ Pull the files from the LAMOST archive """ for f in lamost_id: short = (f.split('-')[2]).split('_')[0] filename = "%s/%s.gz" %(short,f) DIR = "/Users/annaho/Data/Li_Giants/Spectra_APOKASC" searchfor = "%s/%s.gz" %(DIR,f) if glob.glob(searchfor): ...
def get_labels(): """ Labels to make Cannon model spectra """ cannon_teff = data['cannon_teff_2'] cannon_logg = data['cannon_logg_2'] cannon_m_h = data['cannon_m_h'] cannon_alpha_m = data['cannon_alpha_m'] cannon_a_k = data['cannon_a_k'] labels = np.vstack( (cannon_teff, cannon_l...
def cannon_normalize(spec_raw): """ Normalize according to The Cannon """ spec = np.array([spec_raw]) wl = np.arange(0, spec.shape[1]) w = continuum_normalization.gaussian_weight_matrix(wl, L=50) ivar = np.ones(spec.shape)*0.5 cont = continuum_normalization._find_cont_gaussian_smooth( ...
def resample(grid, wl, flux): """ Resample spectrum onto desired grid """ flux_rs = (interpolate.interp1d(wl, flux))(grid) return flux_rs
def gen_cannon_grad_spec(choose, coeffs, pivots): """ Generate Cannon gradient spectra Parameters ---------- labels: default values for [teff, logg, feh, cfe, nfe, afe, ak] choose: val of cfe or nfe, whatever you're varying low: lowest val of cfe or nfe, whatever you're varying high: highes...
def get_model_spec_ting(atomic_number): """ X_u_template[0:2] are teff, logg, vturb in km/s X_u_template[:,3] -> onward, put atomic number atomic_number is 6 for C, 7 for N """ DATA_DIR = "/Users/annaho/Data/LAMOST/Mass_And_Age" temp = np.load("%s/X_u_template_KGh_res=1800.npz" %DATA_DIR) ...
def get_residuals(ds, m): """ Using the dataset and model object, calculate the residuals and return Parameters ---------- ds: dataset object m: model object Return ------ residuals: array of residuals, spec minus model spec """ model_spectra = get_model_spectra(ds, m) resid...
def load_model(): """ Load the model Parameters ---------- direc: directory with all of the model files Returns ------- m: model object """ direc = "/home/annaho/TheCannon/code/lamost/mass_age/cn" m = model.CannonModel(2) m.coeffs = np.load(direc + "/coeffs.npz")['arr_...
def load_dataset(date): """ Load the dataset for a single date Parameters ---------- date: the date (string) for which to load the data & dataset Returns ------- ds: the dataset object """ LAB_DIR = "/home/annaho/TheCannon/data/lamost" WL_DIR = "/home/annaho/TheCannon/code...
def fit_gaussian(x, y, yerr, p0): """ Fit a Gaussian to the data """ try: popt, pcov = curve_fit(gaussian, x, y, sigma=yerr, p0=p0, absolute_sigma=True) except RuntimeError: return [0],[0] return popt, pcov
def select(yerrs, amps, amp_errs, widths): """ criteria for keeping an object """ keep_1 = np.logical_and(amps < 0, widths > 1) keep_2 = np.logical_and(np.abs(amps) > 3*yerrs, amp_errs < 3*np.abs(amps)) keep = np.logical_and(keep_1, keep_2) return keep
def run_all(): """ Load the data that we're using to search for Li-rich giants. Store it in dataset and model objects. """ DATA_DIR = "/home/annaho/TheCannon/code/apogee_lamost/xcalib_4labels" dates = os.listdir("/home/share/LAMOST/DR2/DR2_release") dates = np.array(dates) dates = np.delete(date...
def gen_cannon_grad_spec(base_labels, choose, low, high, coeffs, pivots): """ Generate Cannon gradient spectra Parameters ---------- labels: default values for [teff, logg, feh, cfe, nfe, afe, ak] choose: val of cfe or nfe, whatever you're varying low: lowest val of cfe or nfe, whatever you're ...
def get_err(snr): """ Get approximate scatters from SNR as determined in the code, snr_test.py Order: Teff, logg, MH, CM, NM, alpha """ quad_terms = np.array( [3.11e-3, 1.10e-5, 6.95e-6, 5.05e-6, 4.65e-6, 4.10e-6]) lin_terms = np.array( [-0.869, -2.07e-3, -1.40e-3, -1.03e-3,...
def get_colors(catalog): """ Pull colors from catalog Parameters ---------- catalog: filename """ print("Get Colors") a = pyfits.open(catalog) data = a[1].data a.close() all_ids = data['LAMOST_ID_1'] all_ids = np.array([val.strip() for val in all_ids]) # G magnitude...
def draw_spectra(md, ds): """ Generate best-fit spectra for all the test objects Parameters ---------- md: model The Cannon spectral model ds: Dataset Dataset object Returns ------- best_fluxes: ndarray The best-fit test fluxes best_ivars: The ...
def overlay_spectra(model, dataset): """ Run a series of diagnostics on the fitted spectra Parameters ---------- model: model best-fit Cannon spectral model dataset: Dataset original spectra """ best_flux, best_ivar = draw_spectra(model, dataset) coeffs_all, covs,...
def residuals(cannon_set, dataset): """ Stack spectrum fit residuals, sort by each label. Include histogram of the RMS at each pixel. Parameters ---------- cannon_set: Dataset best-fit Cannon spectra dataset: Dataset original spectra """ print("Stacking spectrum fit res...
def _find_contpix_given_cuts(f_cut, sig_cut, wl, fluxes, ivars): """ Find and return continuum pixels given the flux and sigma cut Parameters ---------- f_cut: float the upper limit imposed on the quantity (fbar-1) sig_cut: float the upper limit imposed on the quantity (f_sig) w...
def _find_contpix(wl, fluxes, ivars, target_frac): """ Find continuum pix in spec, meeting a set target fraction Parameters ---------- wl: numpy ndarray rest-frame wavelength vector fluxes: numpy ndarray pixel intensities ivars: numpy ndarray inverse variances, par...
def _find_contpix_regions(wl, fluxes, ivars, frac, ranges): """ Find continuum pix in a spectrum split into chunks Parameters ---------- wl: numpy ndarray rest-frame wavelength vector fluxes: numpy ndarray pixel intensities ivars: numpy ndarray inverse variances, paral...
def group_data(): """ Load the reference data, and assign each object a random integer from 0 to 7. Save the IDs. """ tr_obj = np.load("%s/ref_id.npz" %direc_ref)['arr_0'] groups = np.random.randint(0, 8, size=len(tr_obj)) np.savez("ref_groups.npz", groups)
def train(ds, ii): """ Run the training step, given a dataset object. """ print("Loading model") m = model.CannonModel(2) print("Training...") m.fit(ds) np.savez("./ex%s_coeffs.npz" %ii, m.coeffs) np.savez("./ex%s_scatters.npz" %ii, m.scatters) np.savez("./ex%s_chisqs.npz" %ii, m.chisqs)...
def xvalidate(): """ Train a model, leaving out a group corresponding to a random integer from 0 to 7, e.g. leave out 0. Test on the remaining 1/8 of the sample. """ print("Loading data") groups = np.load("ref_groups.npz")['arr_0'] ref_label = np.load("%s/ref_label.npz" %direc_ref)['arr_0'] ...
def weighted_std(values, weights): """ Calculate standard deviation weighted by errors """ average = np.average(values, weights=weights) variance = np.average((values-average)**2, weights=weights) return np.sqrt(variance)
def estimate_noise(fluxes, contmask): """ Estimate the scatter in a region of the spectrum taken to be continuum """ nstars = fluxes.shape[0] scatter = np.zeros(nstars) for i,spec in enumerate(fluxes): cont = spec[contmask] scatter[i] = stats.funcs.mad_std(cont) return scatter
def load_ref_spectra(): """ Pull out wl, flux, ivar from files of training spectra """ data_dir = "/Users/annaho/Data/AAOmega/ref_spectra" # Load the files & count the number of training objects ff = glob.glob("%s/*.txt" %data_dir) nstars = len(ff) print("We have %s training objects" %nstars) ...
def load_data(): data_dir = "/Users/annaho/Data/AAOmega" out_dir = "%s/%s" %(data_dir, "Run_13_July") """ Use all the above functions to set data up for The Cannon """ ff, wl, tr_flux, tr_ivar = load_ref_spectra() """ pick one that doesn't have extra dead pixels """ skylines = tr_ivar[4,:] # s...