Skip to content

Instantly share code, notes, and snippets.

@jmatt
Last active April 18, 2018 21:02
Show Gist options
  • Save jmatt/981fb8b3f98e785cc59129a13794f961 to your computer and use it in GitHub Desktop.
Save jmatt/981fb8b3f98e785cc59129a13794f961 to your computer and use it in GitHub Desktop.
LSST EPO User testing spring 2018
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Instructions\n",
"\n",
"*To start your investigation, click \"Run\" from the menu bar, then select \"Run All Cells\"*"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Introduction and Background\n",
"What do you know about star properties, such as their size, temperature and energy output? This investigation will give you the opportunity to create your own \"window\" to the stars, and explore what the view through that window can reveal about star properties. \n",
"Today you will be using a data visualization tool developed more than a century ago called the [H-R Diagram](https://en.wikipedia.org/wiki/Hertzsprung–Russell_diagram). The designation H-R refers to the two astronomers who developed the first such plot: [Ejnar Hertzsprung](https://en.wikipedia.org/wiki/Ejnar_Hertzsprung) from Denmark, and [Henry Norris Russell](https://en.wikipedia.org/wiki/Henry_Norris_Russell), an American.\n",
"\n",
"In order to compare stars to each other, and measure properties such as their energy output, it is important to have a way to control for distance in space. Two stars of the same brightness would look very different if one was farther away from Earth than the other. One way to eliminate that problem is to collect data from a group of stars in a [star cluster](https://en.wikipedia.org/wiki/Star_cluster). By using a cluster, you can make an assumption that all of the stars are the same distance away. Today you will collect and analyze data for the stars in one cluster, and try to understand what you can learn from it. \n",
"\n",
"In this investigation, the term [luminosity](https://en.wikipedia.org/wiki/Luminosity) refers to the total energy output from a star. Luminosity is a ratio of the star's energy output to the Sun, so a star with a luminosity of 10 solar units is 10 times brighter than the Sun."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Procedure and Data\n",
"\n",
"First call up all the information about your star cluster. "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from bokeh.io import output_notebook\n",
"from bokeh.plotting import show\n",
"output_notebook(hide_banner=True)\n",
"\n",
"import hr\n",
"from hr.data import pprint # pprint is an abbreviation for pretty print.\n",
"hr.visual.hr_diagram_skyimage(\"berkeley20\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![Click](http://assets.lsst.rocks/data/icons/sized/svg/eye_16x.svg)*Make your best estimate of which stars in the image belong to the cluster.*\n",
"\n",
"![Click](http://assets.lsst.rocks/data/icons/sized/svg/click_16x.svg)*Use your mouse to outline the boundary of the cluster.*\n",
"\n",
"You will now see a plot of all the data for the stars you selected displayed as an H-R Diagram.\n",
"\n",
"![Click](http://assets.lsst.rocks/data/icons/sized/svg/click_16x.svg)*Click on one of the stars in the cluster. You will see it highlighted on the H-R Diagram. Now try clicking on a star on the diagram, and find it in the cluster. Try this for several stars that look different, and also click on stars in a few different places on the diagram.*\n",
"\n",
"You can use the magnifying glass tool to enlarge the H-R Diagram, and the position tool to navigate to different areas of the H-R Diagram."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![Click](http://assets.lsst.rocks/data/icons/sized/svg/eye_16x.svg)Notice that most stars occupy a region stretching from the upper left to the lower right of the diagram. This is known as the [main sequence](https://cnx.org/contents/LnN76Opl@13.153:EVgehrPG@9/The-HR-Diagram)."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![Click](http://assets.lsst.rocks/data/icons/sized/svg/question_16x.svg)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import ipywidgets as widgets\n",
"question1 = widgets.VBox(children=[widgets.Label(\"1.\tWhere on the main sequence are stars the most numerous? What color are these stars?\"), widgets.Textarea(rows=1)])\n",
"widgets.VBox([question1])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### You will now begin to work with code to define the characteristics of the stars in the cluster. The cell below calls up all data in the cluster and displays it as a data table. Run the cell.\n",
"![Click](http://assets.lsst.rocks/data/icons/sized/svg/click_16x.svg)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"all_star_data = hr.science.table(hr.data.Berkeley20())\n",
"total_number_of_stars = len(all_star_data)\n",
"(x_range, y_range) = hr.visual.calculate_diagram_ranges(all_star_data)\n",
"pprint(all_star_data)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### The cell below sorts the data by temperature values. Run the command and record the maximum and minimum temperatures:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import numpy\n",
"ordered_by_temperature = numpy.sort(all_star_data, axis=None, order='temp')\n",
"pprint(ordered_by_temperature)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![Click](http://assets.lsst.rocks/data/icons/sized/svg/pencil_16x.svg)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import ipywidgets as widgets\n",
"second_question = widgets.VBox(children=[widgets.Label(\"2.\tRecord the hottest and coolest temperatures for the stars in your cluster.\"), widgets.Textarea(rows=1)])\n",
"widgets.VBox([second_question])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### The next cell below sorts the data by luminosity (brightness). Run it and record the maximum and minimum luminosity values:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ordered_by_luminosity = numpy.sort(all_star_data, axis=None, order='lum')\n",
"pprint(ordered_by_luminosity)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![Click](http://assets.lsst.rocks/data/icons/sized/svg/pencil_16x.svg)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import ipywidgets as widgets\n",
"third_question = widgets.VBox(children=[widgets.Label(\"3.\tRecord the largest and smallest luminosities for the stars in your cluster.\"), widgets.Textarea(rows=1)])\n",
"widgets.VBox([third_question])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Now you will use code to define a selected set of stars on the H-R Diagram. The next set of commands displays the (top 20%) hottest stars. Run it, and observe where the stars appear on the diagram: \n",
"![Click](http://assets.lsst.rocks/data/icons/sized/svg/eye_16x.svg)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"number_of_hottest_stars = int(total_number_of_stars * 0.80)\n",
"hottest_stars = ordered_by_temperature[number_of_hottest_stars:total_number_of_stars]\n",
"hr.visual.hr_diagram_from_data(hottest_stars, x_range, y_range)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Now change the code to display where the (20%) coolest stars are located, and run the cell:\n",
"![Click](http://assets.lsst.rocks/data/icons/sized/svg/pencil_16x.svg)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"number_of_coolest_stars = int(total_number_of_stars * 0.20)\n",
"coolest_stars = ordered_by_temperature[0:number_of_coolest_stars]\n",
"hr.visual.hr_diagram_from_data(coolest_stars, x_range, y_range)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Change the code to display where the (20%) most luminous (brightest) stars are located, and run the cell: \n",
"![Click](http://assets.lsst.rocks/data/icons/sized/svg/pencil_16x.svg)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"number_of_bright_stars = int(total_number_of_stars * 0.80)\n",
"brightest_stars = ordered_by_luminosity[number_of_bright_stars:total_number_of_stars]\n",
"hr.visual.hr_diagram_from_data(brightest_stars, x_range, y_range)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Change the code to display where the (20%) least luminous (dimmest) stars are located, and run the cell: \n",
"![Click](http://assets.lsst.rocks/data/icons/sized/svg/pencil_16x.svg)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"number_of_dim_stars = int(total_number_of_stars * 0.20)\n",
"dimmest_stars = ordered_by_luminosity[0:number_of_dim_stars]\n",
"hr.visual.hr_diagram_from_data(dimmest_stars, x_range, y_range)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### It's possible to define a set of stars that share two common characterisitics, such as cool and dim. Study the commands below: \n",
"![Click](http://assets.lsst.rocks/data/icons/sized/svg/eye_16x.svg)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"cool_and_dim_stars = numpy.intersect1d(coolest_stars, dimmest_stars)\n",
"hr.visual.hr_diagram_from_data(cool_and_dim_stars, x_range, y_range)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![Click](http://assets.lsst.rocks/data/icons/sized/svg/question_16x.svg) For the next questions (4a, b, c and d), answer each part by describing an area of the H-R Diagram. Answer with a combination of two of these words: *left, right, top, bottom*, plus a color or colors. "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import ipywidgets as widgets\n",
"question4a = widgets.VBox(children=[widgets.Label(\"4a.\tWhere on the H-R diagram are cool, dim stars located? What color are these stars?\"), widgets.Textarea(rows=1)])\n",
"widgets.VBox([question4a])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Now change the command to display the set of stars that are both cool and bright:\n",
"![Click](http://assets.lsst.rocks/data/icons/sized/svg/pencil_16x.svg)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"cool_and_bright_stars = numpy.intersect1d(coolest_stars, brightest_stars)\n",
"hr.visual.hr_diagram_from_data(cool_and_bright_stars, x_range, y_range)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import ipywidgets as widgets\n",
"question4b = widgets.VBox(children=[widgets.Label(\"4b.\tWhere on the H-R diagram are bright, cool stars located? What color are these stars?\"), widgets.Textarea(rows=1)])\n",
"widgets.VBox([question4b])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Display the set of stars that are both hot and bright: \n",
"![Click](http://assets.lsst.rocks/data/icons/sized/svg/pencil_16x.svg)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"hot_and_bright_stars = numpy.intersect1d(hottest_stars, brightest_stars)\n",
"hr.visual.hr_diagram_from_data(hot_and_bright_stars, x_range, y_range)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import ipywidgets as widgets\n",
"question4c = widgets.VBox(children=[widgets.Label(\"4c.\tWhere on the H-R diagram are hot, bright stars located? What color are these stars?\"), widgets.Textarea(rows=1)])\n",
"widgets.VBox([question4c])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Display the set of stars that are both hot and dim:\n",
"![Click](http://assets.lsst.rocks/data/icons/sized/svg/pencil_16x.svg)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Intersect finds stars in both lists.\n",
"hot_and_dim_stars = numpy.intersect1d(hottest_stars, dimmest_stars)\n",
"hr.visual.hr_diagram_from_data(hot_and_dim_stars, x_range, y_range)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import ipywidgets as widgets\n",
"question4d = widgets.VBox(children=[widgets.Label(\"4d.\tWhere on the H-R diagram are dim, hot stars located? What color are these stars?\"), widgets.Textarea(rows=1)])\n",
"widgets.VBox([question4d])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![Click](http://assets.lsst.rocks/data/icons/sized/svg/question_16x.svg) \n",
"# Discuss and report\n",
"#### *Take a few minutes with your partner or small group to investigate and discuss the following:*"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import ipywidgets as widgets\n",
"question5 = widgets.VBox(children=[widgets.Label(\"5.\tThe Sun’s surface temperature is about 6000K. Suppose a main sequence star has a temperature three times greater than the Sun’s. How much more luminous than the Sun is the hotter star? Use your diagram to estimate an answer.\"), widgets.Textarea(rows=1)])\n",
"question6 = widgets.VBox(children=[widgets.Label(\"6.\tTwo stars have the same luminosity but differ in color. What physical property of the stars could explain this?\"), widgets.Textarea(rows=1)])\n",
"question7 = widgets.VBox(children=[widgets.Label(\"7.\tTwo supergiant stars have the same luminosity. One is yellow and the other is orange. Which one is larger? Explain your reasoning.\"), widgets.Textarea(rows=1)])\n",
"question8 = widgets.VBox(children=[widgets.Label(\"8.\tWhat physical property of stars could explain why stars in the lower left of the H-R Diagram are dimmer than the stars in the upper left, since they are both very hot?\"), widgets.Textarea(rows=1)])\n",
"widgets.VBox([question5, question6, question7, question8])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### *Be prepared to report out and discuss your observations.*"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Summary\n",
"![Click](http://assets.lsst.rocks/data/icons/sized/svg/pencil_16x.svg) 9. Now that you have had a chance to discuss your observations, write a summary in the text box below that explains what you have learned about star temperatures, sizes and luminosities."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import ipywidgets as widgets\n",
"widgets.VBox([widgets.Textarea(rows=6), widgets.Label(value=\"When you are done, click Submit to send your completed notebook to your teacher.\"), widgets.Button(description=\"Submit\")])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Challenge Problem\n",
"\n",
"Use what you have learned to write code that will display only the *blue stars* in your cluster. Enter the code in the box below and run it:\n",
"![Click](http://assets.lsst.rocks/data/icons/sized/pencil_16x.jpeg)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Write the code in this cell and run it:\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![Click](http://assets.lsst.rocks/data/icons/sized/svg/question_16x.svg)"
]
}
],
"metadata": {
"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.4.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment