# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# ## Instructions
# Please be patient while waiting for the environment to load; it may take a few minutes. 
# Once the notebook has finished loading, in the top bar, select `Kernel`--> `Restart & Run All`. 
# Once cell has finished running, you should see a plot with  sliders appear at the bottom.
# Enjoy!

#Imports
import sys;
sys.path.append('../python/');
import widget_BH_clean as widget;
# %matplotlib inline
# Widget Output
widget.VBox([widget.button,widget.out,widget.interactive_plot(widget.f)])

# ## Description for NGC 5533 slider:
#
# Black holes are ***MACHOs*** or Massive Compact Halo Objects. They are hard to detect with our present technology, especially if they have small masses. For example, a black hole with the mass of our sun has an event horizon radius of 3 km. A solar-mass sized black hole would be so tiny that the only way we would be able to see it is by gravitational microlensing (blackhole passing in front of a star). 
#
# The left photo is an arbitrary face-on galaxy (NGC 6814) for a better visualization of the spread of the number of black holes. ***Each dot represents 1 million tiny black holes***. 
#
# Increasing the number and mass of each black hole can change the velocities of the stars in a galaxy (velocity curve). 
# There are three sliders that can change the velocity curve of the dark halo. 
# 1. ***Number of millions of tiny black holes***: We need to start with an incredibly high number of tiny black holes to account for the dark matter halo curve. Starting with merely 50 million, all the way up to 500 million tiny black holes, the velocity curve changes drastically.
# 2. ***Mass of each tiny black hole (in solar masses)***: Starting from 0.1 solar masses, and up to 3.8 solar masses (which is the smallest black hole ever discovered according to https://www.scientificamerican.com/gallery/the-smallest-known-black-hole/), this slider can change the mass of each black hole. 
# 3. ***Cutoff radius***: The cutoff radius (also called "scale radius") indicates where the density falls off by a factor of e (~2.7). Adjusting this factor changes where the "bump" of the curve is located. 
#
# All other components (bulge, disk, central supermassive black hole) are fixed because these values (their mass to light ratio) can be measured. 
#
# ### ... 
# If you wish to see the optimal number and individual mass of theoretical black holes, press the `Best Fit` button at any time. But be creative, there's more than one optimal combination. Enjoy!

#Imports
import sys;
sys.path.append('./python/');
import w5 as widget;
# Widget Output
# %matplotlib inline
widget.VBox([widget.button,widget.out,widget.interactive_plot(widget.f)])

# ## Description for NGC 7814 slider:
#
# ### Right Graph:
# The rotation curve of NGC 7814 (represented by blue data points in the right graph) is emulated after Fraternali et al. (2011) which can be accessed <a href="https://arxiv.org/pdf/1105.3867.pdf">here</a>. The graph to the right represents an interactive rotation curve of NGC 7814 similar to what you can see in our rotation curve widget program, however, in this case all components have been fixed except for the dark matter component (green line), and now it is modeled based on a hypothetical mass distribution of small black holes.
# ### Left Graph:
# The left graph shows a visual helper of what the rotation curve is physically describing (note that the galaxy image used is NOT of NGC 7814, but a similar spiral galaxy). Here, each dot represents 23 million blackholes (an arbitrary scaling factor). Keep careful watch as you move the sliders to see each "black hole" (red dots) change in quantity and size. It's up to you to choose how many black holes (by factors of 23 million) and masses of each black hole in solar masses (1 solar mass = almost $2 × 10^{30}$ kilograms!) to find a "best fit" rotation curve, which is to say, a mass distrubtion of black holes that would most closely match real observations.
# ### ... 
# If you wish to see the optimal number and individual mass of theoretical black holes, press the `Best Fit` button at any time. But be creative, there's more than one optimal combination. Enjoy!

# ## Image Sources:
# “A Spiral Snowflake.” The European Space Agency, ESA/Hubble &amp; NASA, 9 May 2016, esahubble.org/images/potw1619a/.
#
# ## References: 
# F.  <NAME>.  <NAME>.  Kamphuis (2011), **A tale of two galaxies: light and mass in NGC 891 and NGC 7814**. Astronomy & Astrophysics, 531: A64. https://doi.org/10.1051/0004-6361/201116634
#
# <NAME>. (2008), **The rotation curves of flattened Sérsic bulges**. Monthly Notices of the Royal Astronomical Society, 385: 1359-1364. https://doi.org/10.1111/j.1365-2966.2008.12837.x
#
# NASA. “**The Smallest Known Black Hole**.” Scientific American, 2 Apr. 2008, www.scientificamerican.com/gallery/the-smallest-known-black-hole.
#
# “**GIPSY, the Groningen Image Processing System**.” GIPSY, www.astro.rug.nl/~gipsy/index.html. Accessed 2020-2021.



StarcoderdataJupyterScriptsDedupFiltered