Skip to content

Commit

Permalink
add astroscrappy import as last step in assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
Swanson-Hysell committed Nov 7, 2019
1 parent 6630b20 commit 1c19aaa
Showing 1 changed file with 91 additions and 208 deletions.
299 changes: 91 additions & 208 deletions Week09_Volcanic_Geochemistry/Week09_Assignment_Cobalt_Resources.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -47,7 +47,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -80,216 +80,62 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"\u001b[0;31mSignature:\u001b[0m\n",
"\u001b[0msns\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mboxenplot\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0my\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mhue\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mdata\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0morder\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mhue_order\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0morient\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mcolor\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mpalette\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0msaturation\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m0.75\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mwidth\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m0.8\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mdodge\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mk_depth\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'proportion'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mlinewidth\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mscale\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'exponential'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0moutlier_prop\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0max\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mDocstring:\u001b[0m\n",
"Draw an enhanced box plot for larger datasets.\n",
"\n",
"This style of plot was originally named a \"letter value\" plot because it\n",
"shows a large number of quantiles that are defined as \"letter values\". It\n",
"is similar to a box plot in plotting a nonparametric representation of a\n",
"distribution in which all features correspond to actual observations. By\n",
"plotting more quantiles, it provides more information about the shape of\n",
"the distribution, particularly in the tails. For a more extensive\n",
"explanation, you can read the paper that introduced the plot:\n",
"\n",
"https://vita.had.co.nz/papers/letter-value-plot.html\n",
"\n",
"\n",
"Input data can be passed in a variety of formats, including:\n",
"\n",
"- Vectors of data represented as lists, numpy arrays, or pandas Series\n",
" objects passed directly to the ``x``, ``y``, and/or ``hue`` parameters.\n",
"- A \"long-form\" DataFrame, in which case the ``x``, ``y``, and ``hue``\n",
" variables will determine how the data are plotted.\n",
"- A \"wide-form\" DataFrame, such that each numeric column will be plotted.\n",
"- An array or list of vectors.\n",
"\n",
"In most cases, it is possible to use numpy or Python objects, but pandas\n",
"objects are preferable because the associated names will be used to\n",
"annotate the axes. Additionally, you can use Categorical types for the\n",
"grouping variables to control the order of plot elements. \n",
"\n",
"This function always treats one of the variables as categorical and\n",
"draws data at ordinal positions (0, 1, ... n) on the relevant axis, even\n",
"when the data has a numeric or date type.\n",
"\n",
"See the :ref:`tutorial <categorical_tutorial>` for more information. \n",
"\n",
"Parameters\n",
"----------\n",
"x, y, hue : names of variables in ``data`` or vector data, optional\n",
" Inputs for plotting long-form data. See examples for interpretation. \n",
"data : DataFrame, array, or list of arrays, optional\n",
" Dataset for plotting. If ``x`` and ``y`` are absent, this is\n",
" interpreted as wide-form. Otherwise it is expected to be long-form. \n",
"order, hue_order : lists of strings, optional\n",
" Order to plot the categorical levels in, otherwise the levels are\n",
" inferred from the data objects. \n",
"orient : \"v\" | \"h\", optional\n",
" Orientation of the plot (vertical or horizontal). This is usually\n",
" inferred from the dtype of the input variables, but can be used to\n",
" specify when the \"categorical\" variable is a numeric or when plotting\n",
" wide-form data. \n",
"color : matplotlib color, optional\n",
" Color for all of the elements, or seed for a gradient palette. \n",
"palette : palette name, list, or dict, optional\n",
" Colors to use for the different levels of the ``hue`` variable. Should\n",
" be something that can be interpreted by :func:`color_palette`, or a\n",
" dictionary mapping hue levels to matplotlib colors. \n",
"saturation : float, optional\n",
" Proportion of the original saturation to draw colors at. Large patches\n",
" often look better with slightly desaturated colors, but set this to\n",
" ``1`` if you want the plot colors to perfectly match the input color\n",
" spec. \n",
"width : float, optional\n",
" Width of a full element when not using hue nesting, or width of all the\n",
" elements for one level of the major grouping variable. \n",
"dodge : bool, optional\n",
" When hue nesting is used, whether elements should be shifted along the\n",
" categorical axis. \n",
"k_depth : \"proportion\" | \"tukey\" | \"trustworthy\", optional\n",
" The number of boxes, and by extension number of percentiles, to draw.\n",
" All methods are detailed in Wickham's paper. Each makes different\n",
" assumptions about the number of outliers and leverages different\n",
" statistical properties.\n",
"linewidth : float, optional\n",
" Width of the gray lines that frame the plot elements. \n",
"scale : \"linear\" | \"exponential\" | \"area\"\n",
" Method to use for the width of the letter value boxes. All give similar\n",
" results visually. \"linear\" reduces the width by a constant linear\n",
" factor, \"exponential\" uses the proportion of data not covered, \"area\"\n",
" is proportional to the percentage of data covered.\n",
"outlier_prop : float, optional\n",
" Proportion of data believed to be outliers. Used in conjunction with\n",
" k_depth to determine the number of percentiles to draw. Defaults to\n",
" 0.007 as a proportion of outliers. Should be in range [0, 1].\n",
"ax : matplotlib Axes, optional\n",
" Axes object to draw the plot onto, otherwise uses the current Axes. \n",
"kwargs : key, value mappings\n",
" Other keyword arguments are passed through to ``plt.plot`` and\n",
" ``plt.scatter`` at draw time.\n",
"\n",
"Returns\n",
"-------\n",
"ax : matplotlib Axes\n",
" Returns the Axes object with the plot drawn onto it. \n",
"\n",
"See Also\n",
"--------\n",
"violinplot : A combination of boxplot and kernel density estimation. \n",
"boxplot : A traditional box-and-whisker plot with a similar API. \n",
"\n",
"Examples\n",
"--------\n",
"\n",
"Draw a single horizontal boxen plot:\n",
"\n",
".. plot::\n",
" :context: close-figs\n",
"\n",
" >>> import seaborn as sns\n",
" >>> sns.set(style=\"whitegrid\")\n",
" >>> tips = sns.load_dataset(\"tips\")\n",
" >>> ax = sns.boxenplot(x=tips[\"total_bill\"])\n",
"\n",
"Draw a vertical boxen plot grouped by a categorical variable:\n",
"\n",
".. plot::\n",
" :context: close-figs\n",
"\n",
" >>> ax = sns.boxenplot(x=\"day\", y=\"total_bill\", data=tips)\n",
"\n",
"Draw a letter value plot with nested grouping by two categorical variables:\n",
"\n",
".. plot::\n",
" :context: close-figs\n",
"\n",
" >>> ax = sns.boxenplot(x=\"day\", y=\"total_bill\", hue=\"smoker\",\n",
" ... data=tips, palette=\"Set3\")\n",
"\n",
"Draw a boxen plot with nested grouping when some bins are empty:\n",
"\n",
".. plot::\n",
" :context: close-figs\n",
"\n",
" >>> ax = sns.boxenplot(x=\"day\", y=\"total_bill\", hue=\"time\",\n",
" ... data=tips, linewidth=2.5)\n",
"\n",
"Control box order by passing an explicit order:\n",
"\n",
".. plot::\n",
" :context: close-figs\n",
"\n",
" >>> ax = sns.boxenplot(x=\"time\", y=\"tip\", data=tips,\n",
" ... order=[\"Dinner\", \"Lunch\"])\n",
"\n",
"Draw a boxen plot for each numeric variable in a DataFrame:\n",
"\n",
".. plot::\n",
" :context: close-figs\n",
"\n",
" >>> iris = sns.load_dataset(\"iris\")\n",
" >>> ax = sns.boxenplot(data=iris, orient=\"h\", palette=\"Set2\")\n",
"\n",
"Use :func:`stripplot` to show the datapoints on top of the boxes:\n",
"\n",
".. plot::\n",
" :context: close-figs\n",
"\n",
" >>> ax = sns.boxenplot(x=\"day\", y=\"total_bill\", data=tips)\n",
" >>> ax = sns.stripplot(x=\"day\", y=\"total_bill\", data=tips,\n",
" ... size=4, jitter=True, color=\"gray\")\n",
"\n",
"Use :func:`catplot` to combine :func:`boxenplot` and a :class:`FacetGrid`.\n",
"This allows grouping within additional categorical variables. Using\n",
":func:`catplot` is safer than using :class:`FacetGrid` directly, as it\n",
"ensures synchronization of variable order across facets:\n",
"\n",
".. plot::\n",
" :context: close-figs\n",
"\n",
" >>> g = sns.catplot(x=\"sex\", y=\"total_bill\",\n",
" ... hue=\"smoker\", col=\"time\",\n",
" ... data=tips, kind=\"boxen\",\n",
" ... height=4, aspect=.7);\n",
"\u001b[0;31mFile:\u001b[0m /anaconda3/lib/python3.6/site-packages/seaborn/categorical.py\n",
"\u001b[0;31mType:\u001b[0m function\n"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"outputs": [],
"source": [
"sns.boxenplot?"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
Expand All @@ -298,6 +144,43 @@
"\n",
"https://pubs.usgs.gov/of/2017/1155/ofr20171155.pdf"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Make sure that you can run the three cells below before uploading the assignment\n",
"\n",
"You will not be able to run this on DataHub. Instead you need to download this notebook to your local computer and run the following cells. The first one will install astropy and astroscrappy (as well as other dependencies) which are necessary for what we will be doing in class on Tuesday."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%conda install astroscrappy"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from astropy.io import fits\n",
"import astroscrappy"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"astroscrappy.detect_cosmics?"
]
}
],
"metadata": {
Expand All @@ -316,7 +199,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.7"
"version": "3.7.4"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 1c19aaa

Please sign in to comment.