<jupyter_start><jupyter_text>Careful, these constants may be different for you:<jupyter_code>DATA_PATH = '~/Desktop/honours/sdss_dr7_photometry_source.csv.gz'<jupyter_output><empty_output><jupyter_text>Import all the things.<jupyter_code>import mclearn.viz
import numpy as np
import pandas as pd

%matplotlib inline<jupyter_output><empty_output><jupyter_text>Importing data.<jupyter_code>def load_data(data_cols=('ra', 'dec', 'redshift'),
              filter_col='class',
              filter_val='Galaxy'):
    
    data_cols = list(data_cols)
    
    data_iter = pd.read_csv(
        DATA_PATH,
        iterator=True,
        chunksize=100000,
        usecols=data_cols + [filter_col])
    
    if filter_col is None:
        # Filtering disabled
        data = pd.concat(data_iter)
    else:
        # Filter out anything that is not a galaxy without loading the whole file into memory.
        data = pd.concat(chunk[chunk[filter_col] == filter_val]
                         for chunk in data_iter)

    return data


data = load_data()<jupyter_output><empty_output><jupyter_text>Plotting.<jupyter_code>def plot(data):
    ra = data['ra']
    dec = data['dec']
    redshift = data['redshift']
    
    assert ra.shape == dec.shape == redshift.shape
    
    mclearn.viz.plot_hex_map(
        ra,
        dec,
        C=redshift,
        vmin=np.mean(redshift) - np.std(redshift),
        vmax=np.mean(redshift) + np.std(redshift),
        title='Mean Redshift by R.A./DEC')
    

plot(data)<jupyter_output>/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/cbook.py:136: MatplotlibDeprecationWarning: The axisbg attribute was deprecated in version 2.0. Use facecolor instead.
  warnings.warn(message, mplDeprecation, stacklevel=1)
{'fraction_non_alphanumeric': 0.10935738444193913, 'fraction_numerical': 0.009582863585118376, 'mean_word_length': 3.266826923076923, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '364274', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 619, 'n_tokens_neox': 598, 'n_words': 112, 'path': 'projects/jakub/lat_lng_z_plot/lat_lng_z_plot.ipynb', 'repo_name': 'chengsoonong/mclass-sky', 'size': '1774'}