{"cells": [{"cell_type": "markdown", "metadata": {}, "source": ["# Exercise 7.1: Computing things!\n", "\n", "
"]}, {"cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": ["import pandas as pd"]}, {"cell_type": "markdown", "metadata": {}, "source": ["
\n", "\n", "We have looked at a data set from Harvey and Orbidans on the cross-sectional area of *C. elegans* eggs. Recall, we loaded the data and converted everything to Numpy arrays like this:"]}, {"cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": ["df = pd.read_csv('data/c_elegans_egg_xa.csv', comment='#')\n", "\n", "xa_high = df.loc[df['food']=='high', 'area (sq. um)'].values\n", "xa_low = df.loc[df['food']=='low', 'area (sq. um)'].values"]}, {"cell_type": "markdown", "metadata": {}, "source": ["Now we would like to compute the diameter of the egg from the cross-sectional area. Write a function that takes in an array of cross-sectional areas and returns an array of diameters. Recall that the diameter $d$ and cross-sectional area $A$ are related by $A = \\pi d^2/4$. There should be no `for` loops in your function! The call signature is\n", "\n", "```python\n", "xa_to_diameter(xa)\n", "```\n", "\n", "Use your function to compute the diameters of the eggs."]}, {"cell_type": "markdown", "metadata": {}, "source": ["
"]}], "metadata": {"anaconda-cloud": {}, "kernelspec": {"display_name": "Python 3", "language": "python", "name": "python3"}, "language_info": {"codemirror_mode": {"name": "ipython", "version": 3}, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.10"}}, "nbformat": 4, "nbformat_minor": 4}