{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "dd11e5bc",
   "metadata": {},
   "outputs": [],
   "source": [
    "%load_ext autoreload\n",
    "%autoreload 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "2fdbf09c",
   "metadata": {},
   "outputs": [],
   "source": [
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "dab581da",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "don't have phil's colormaps\n"
     ]
    }
   ],
   "source": [
    "from abg_private.gal_utils import Galaxy,ManyGalaxy"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "724424bf",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "9052cf9a",
   "metadata": {},
   "outputs": [],
   "source": [
    "many_galaxy = ManyGalaxy('m12b_res7100',use_rockstar_first=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "755f891a",
   "metadata": {},
   "outputs": [],
   "source": [
    "galaxy = Galaxy('m12b_res7100',600,use_rockstar_first=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "8555a752",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "cache bursty compute_bursty_regime(m12b_res7100 at 600,){} fail :[ No unloaded or loaded metadata attrs matches bursty_bursty_index!\n",
      "Already opened the final snapshot!\n",
      "Using the saved sub-snapshots for m12b_res7100 at 600\n",
      "Successfully loaded a pre-extracted subsnap\n",
      "Reorienting...\n",
      "Done.\n",
      "extract_halo_inner(m12b_res7100 at 600,){'orient_stars': True} 17.31 s elapsed\n",
      "Snapshot memory free\n",
      "outputting sfrcat to: /home1/04210/tg835099/scratch/data/metal_diffusion/m12b_res7100/sfrcat_600_1Myr radial_thresh: 14.747337651123974\n",
      "compute_bursty_regime(m12b_res7100 at 600,){} 22.43 s elapsed\n",
      "[1.    1.    1.    1.    1.    1.    3.698]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home1/04210/tg835099/python/abg_python/galaxy/sfr_utils.py:512: RuntimeWarning: invalid value encountered in true_divide\n",
      "  SFR_metals = SFR_metals/SFRs # metal masses / total masses -> metal mass fraction in each bin\n"
     ]
    }
   ],
   "source": [
    "times = np.linspace(-3,3,7) + galaxy.get_bursty_regime()[1]\n",
    "times = np.append(times,galaxy.current_time_Gyr)\n",
    "print(np.diff(times))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "6a53a5c7",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "cache SimpleGeom_gas compute_simple_radius_and_height(m12b_res7100 at 600, 'gas'){'rmax': 33.50997314453125} success!\n",
      "datadir: /home1/04210/tg835099/scratch/data/metal_diffusion/m12b_res7100/firefly/m12b_res7100_600 -- is not a sub-directory of firefly/static/data. \n",
      "This may produce confusing or inoperable results. As such, we will create a symlink for you when you writeToDisk.\n"
     ]
    }
   ],
   "source": [
    "many_galaxy.create_firefly_scenes(times=times,overwrite=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "85d19179",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['#4477AA', array([0.78787879, 0.71515152, 0.35151515]), '#CC6677', '#117733', '#AA4499', '#88CCEE', array([0.87333333, 0.50933333, 0.28066667])]\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAgAAAABACAYAAABsv8+/AAAAGHRFWHRUaXRsZQBmcm9tX2xpc3QgY29sb3JtYXBDL89FAAAAHnRFWHREZXNjcmlwdGlvbgBmcm9tX2xpc3QgY29sb3JtYXABtCnOAAAAMHRFWHRBdXRob3IATWF0cGxvdGxpYiB2My40LjMsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcJXfPTAAAAMnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHYzLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZyf7bPQAAAFmSURBVHic7dYxcUJRAADBkMEABrCSBiSEGQxgAQMpsIAFGmjSYQELWAEHlLzP3K6CK2+22p8eX7z093MenTB588tydMLkrRfX0QmTd7ztRid8hPvhd3TCpG3+t6MTPsL36AAA4P0MAAAEGQAACDIAABBkAAAgyAAAQJABAIAgAwAAQQYAAIIMAAAEGQAACDIAABBkAAAgyAAAQJABAIAgAwAAQQYAAIIMAAAEGQAACDIAABBkAAAgyAAAQJABAIAgAwAAQQYAAIIMAAAEGQAACDIAABBkAAAgyAAAQJABAIAgAwAAQQYAAIIMAAAEGQAACDIAABBkAAAgyAAAQJABAIAgAwAAQQYAAIIMAAAEGQAACDIAABBkAAAgyAAAQJABAIAgAwAAQQYAAIIMAAAEGQAACDIAABBkAAAgyAAAQJABAIAgAwAAQQYAAIIMAAAEGQAACDIAABBkAAAgyAAAQJABAICgJxu6CyXUeCayAAAAAElFTkSuQmCC\n",
      "text/html": [
       "<div style=\"vertical-align: middle;\"><strong>from_list</strong> </div><div class=\"cmap\"><img alt=\"from_list colormap\" title=\"from_list\" style=\"border: 1px solid #555;\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAABACAYAAABsv8+/AAAAGHRFWHRUaXRsZQBmcm9tX2xpc3QgY29sb3JtYXBDL89FAAAAHnRFWHREZXNjcmlwdGlvbgBmcm9tX2xpc3QgY29sb3JtYXABtCnOAAAAMHRFWHRBdXRob3IATWF0cGxvdGxpYiB2My40LjMsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcJXfPTAAAAMnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHYzLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZyf7bPQAAAFmSURBVHic7dYxcUJRAADBkMEABrCSBiSEGQxgAQMpsIAFGmjSYQELWAEHlLzP3K6CK2+22p8eX7z093MenTB588tydMLkrRfX0QmTd7ztRid8hPvhd3TCpG3+t6MTPsL36AAA4P0MAAAEGQAACDIAABBkAAAgyAAAQJABAIAgAwAAQQYAAIIMAAAEGQAACDIAABBkAAAgyAAAQJABAIAgAwAAQQYAAIIMAAAEGQAACDIAABBkAAAgyAAAQJABAIAgAwAAQQYAAIIMAAAEGQAACDIAABBkAAAgyAAAQJABAIAgAwAAQQYAAIIMAAAEGQAACDIAABBkAAAgyAAAQJABAIAgAwAAQQYAAIIMAAAEGQAACDIAABBkAAAgyAAAQJABAIAgAwAAQQYAAIIMAAAEGQAACDIAABBkAAAgyAAAQJABAIAgAwAAQQYAAIIMAAAEGQAACDIAABBkAAAgyAAAQJABAICgJxu6CyXUeCayAAAAAElFTkSuQmCC\"></div><div style=\"vertical-align: middle; max-width: 514px; display: flex; justify-content: space-between;\"><div style=\"float: left;\"><div title=\"#4477aaff\" style=\"display: inline-block; width: 1em; height: 1em; margin: 0; vertical-align: middle; border: 1px solid #555; background-color: #4477aaff;\"></div> under</div><div style=\"margin: 0 auto; display: inline-block;\">bad <div title=\"#00000000\" style=\"display: inline-block; width: 1em; height: 1em; margin: 0; vertical-align: middle; border: 1px solid #555; background-color: #00000000;\"></div></div><div style=\"float: right;\">over <div title=\"#df8248ff\" style=\"display: inline-block; width: 1em; height: 1em; margin: 0; vertical-align: middle; border: 1px solid #555; background-color: #df8248ff;\"></div></div>"
      ],
      "text/plain": [
       "<matplotlib.colors.ListedColormap at 0x2b0f883f5d90>"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from abg_python.color_utils import my_qualitative_colors\n",
    "from matplotlib.colors import ListedColormap\n",
    "print(my_qualitative_colors)\n",
    "ListedColormap(my_qualitative_colors)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9b74da8a",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "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.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
