{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "dde7fbc8-a773-4e19-a5b7-d8afc8059f45",
   "metadata": {},
   "outputs": [],
   "source": [
    "import h5py\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "9b641627-5f6c-45c3-b067-bda82486583c",
   "metadata": {},
   "outputs": [],
   "source": [
    "import os"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "7cbc8f7d-417a-4f83-b441-1aec93b3f8b0",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "palettable colormaps are not installed\n",
      "don't have phil's colormaps\n"
     ]
    }
   ],
   "source": [
    "from abg_python.plot_utils import plt\n",
    "\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "bbf97477-cde1-464d-9a5a-a977120c2142",
   "metadata": {},
   "outputs": [],
   "source": [
    "%load_ext autoreload\n",
    "%autoreload 2\n",
    "\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "\n",
    "from astropy.table import Table, Column\n",
    "import astropy.units as u\n",
    "from astropy.coordinates import SkyCoord, ICRS\n",
    "from astropy.io import ascii"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "90047873-2727-4274-952e-fc61e90f7607",
   "metadata": {},
   "outputs": [],
   "source": [
    "useGaiaData = {}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "418b9803-b073-4edb-8604-6aee581183ff",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "9.588463290900924"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "foo = \"\"\"XpContinuousMeanSpectrum/\t2.644TB\t2022-06-01 11:39 UTC\n",
    "Ravedr6BestNeighbour/\t32.24MB\t2022-06-01 05:15 UTC\n",
    "NssNonLinearSpectro/\t5.263MB\t2022-06-01 05:15 UTC\n",
    "VariEpochRadialVelocity/\t6.706MB\t2022-06-01 05:18 UTC\n",
    "GoldSampleSpss/\t48.14KB\t2022-06-01 05:15 UTC\n",
    "NssAccelerationAstro/\t98.39MB\t2022-06-01 05:15 UTC\n",
    "VariClassifierDefinition/\t6.129KB\t2022-06-01 05:18 UTC\n",
    "XpSampling/\t2.250MB\t2022-06-01 11:56 UTC\n",
    "AstrophysicalParameters/\t1.343TB\t2022-06-01 04:19 UTC\n",
    "AlertsMixedinSourceids/\t4.297KB\t2022-06-05 16:09 UTC\n",
    "VariPlanetaryTransit/\t988.6KB\t2022-06-01 05:19 UTC\n",
    "VariAgn/\t35.98MB\t2022-06-01 05:18 UTC\n",
    "GoldSampleObaStars/\t34.60MB\t2022-06-01 05:15 UTC\n",
    "VariRrlyrae/\t463.7MB\t2022-06-01 05:19 UTC\n",
    "SsoSource/\t12.40MB\t2022-06-01 05:17 UTC\n",
    "BinaryMasses/\t30.23MB\t2022-06-01 03:51 UTC\n",
    "VariRotationModulation/\t1.416GB\t2022-06-01 05:19 UTC\n",
    "RvsMeanSpectrum/\t18.05GB\t2022-06-01 05:17 UTC\n",
    "VariCompactCompanion/\t22.43MB\t2022-06-01 05:18 UTC\n",
    "McmcSamplesMsc/\t1.147TB\t2022-06-06 00:33 UTC\n",
    "XpSampledMeanSpectrum/\t89.14GB\t2022-06-01 11:56 UTC\n",
    "SsoObservation/\t8.216GB\t2022-06-01 05:17 UTC\n",
    "GoldSampleCarbonStars/\t125.1KB\t2022-06-01 05:15 UTC\n",
    "Ravedr6Neighbourhood/\t35.72MB\t2022-06-01 05:15 UTC\n",
    "NssVimFl/\t207.8KB\t2022-06-01 05:15 UTC\n",
    "VariMsOscillator/\t18.82MB\t2022-06-01 05:19 UTC\n",
    "VariShortTimescale/\t40.40MB\t2022-06-01 05:19 UTC\n",
    "VariMicrolensing/\t4.272MB\t2022-06-01 05:19 UTC\n",
    "TotalGalacticExtinctionMapOpt/\t93.00MB\t2022-06-05 17:49 UTC\n",
    "SsoOrbits/\t89.53MB\t2022-06-01 05:17 UTC\n",
    "ScienceAlerts/\t88.27KB\t2022-06-05 16:18 UTC\n",
    "GoldSampleFgkmStars/\t374.2MB\t2022-06-01 05:15 UTC\n",
    "NssTwoBodyOrbit/\t511.5MB\t2022-06-01 05:15 UTC\n",
    "QsoCandidates/\t2.097GB\t2022-06-01 05:15 UTC\n",
    "GoldSampleUcd/\t662.3KB\t2022-06-01 05:15 UTC\n",
    "GoldSampleSolarAnalogues/\t47.90KB\t2022-06-01 05:15 UTC\n",
    "VariSummary/\t3.222GB\t2022-06-01 05:20 UTC\n",
    "VariCepheid/\t91.86MB\t2022-06-01 05:18 UTC\n",
    "VariClassifierClassDefinition/\t9.547KB\t2022-06-01 05:18 UTC\n",
    "TotalGalacticExtinctionMap/\t171.3MB\t2022-06-05 17:47 UTC\n",
    "SsoReflectanceSpectrum/\t81.93MB\t2022-06-01 05:17 UTC\n",
    "QsoCatalogueName/\t49.61MB\t2022-06-01 05:15 UTC\n",
    "Ravedr6Join/\t29.67MB\t2022-06-01 05:15 UTC\n",
    "GalaxyCandidates/\t1.565GB\t2022-06-01 05:14 UTC\n",
    "AstrophysicalParametersSupp/\t311.3GB\t2022-06-01 03:51 UTC\n",
    "McmcSamplesGspPhot/\t2.855TB\t2022-06-06 09:58 UTC\n",
    "XpSummary/\t13.10GB\t2022-06-01 11:58 UTC\n",
    "OaNeuronXpSpectra/\t2.394MB\t2022-06-05 16:16 UTC\n",
    "XpMerge/\t10.79KB\t2022-06-01 11:39 UTC\n",
    "VariClassifierResult/\t223.5MB\t2022-06-01 05:18 UTC\n",
    "GalaxyCatalogueName/\t18.44MB\t2022-06-01 05:15 UTC\n",
    "OaNeuronInformation/\t333.1KB\t2022-06-05 16:13 UTC\n",
    "EpochPhotometry/\t135.5GB\t2022-06-01 03:55 UTC\n",
    "GaiaCrf3Xm/\t580.5MB\t2022-06-01 04:19 UTC\n",
    "VariEclipsingBinary/\t407.4MB\t2022-06-01 05:18 UTC\n",
    "VariLongPeriodVariable/\t79.12MB\t2022-06-01 05:19 UTC\n",
    "SyntheticPhotometryGspc/\t36.91GB\t2022-06-01 05:18 UTC\n",
    "aux/\t862.3KB\t2022-06-05 17:51 UTC\n",
    "VariRadVelStatistics/\t9.526MB\t2022-06-01 05:19 UTC\n",
    "GaiaSource/\t0.990TB\t2022-06-01 05:14 UTC\"\"\"\n",
    "\n",
    "bar = np.array([string.split('\\t') for string in foo.split('\\n')])\n",
    "\n",
    "sizes = []\n",
    "fact = 1024\n",
    "\n",
    "for size in bar[:,1]:\n",
    "    if 'KB' in size: power = 1\n",
    "    elif 'MB' in size: power = 2\n",
    "    elif 'GB' in size: power = 3\n",
    "    elif 'TB' in size: power = 4\n",
    "    else: raise ValueError\n",
    "    sizes+=[eval(size[:-2])*fact**power]\n",
    "np.sum(sizes)/fact**4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "a9697ba3-8b4e-4848-be6a-0ea948f473a8",
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "\n",
    "def readGaiaFile(path,limiting_mag,extra_keys=None,loud=False,has_RV=True):\n",
    "    useGaiaData = {}\n",
    "    \n",
    "    if extra_keys is None: extra_keys  = []\n",
    "    \n",
    "    keys = ['dec','ra','parallax','pmdec','pmra','radial_velocity','bp_rp','phot_g_mean_mag'] + extra_keys\n",
    "    \n",
    "    with h5py.File(path,'r') as handle:\n",
    "    \n",
    "        for key in keys: \n",
    "            try:\n",
    "                unit_strs = handle[key].attrs['unit'].decode('utf-8').split('.')\n",
    "                units = 1\n",
    "                for unit_str in unit_strs:\n",
    "                    if '**-1' in unit_str: units/=getattr(u,unit_str[:-4])\n",
    "                    else: units*=getattr(u,unit_str)\n",
    "            except:\n",
    "                print(unit_str)\n",
    "                raise\n",
    "            useGaiaData[key] = handle[key][()]*units\n",
    "            nans = np.isnan(useGaiaData[key])\n",
    "            #if loud: print(key,':',f\"{np.sum(nans)/nans.size*100:.1f} %\")\n",
    "        #if loud: print(nans.size,'stars')\n",
    "\n",
    "    mask = np.isfinite(useGaiaData['radial_velocity'])\n",
    "    \n",
    "    if not has_RV: mask = ~mask\n",
    "    \n",
    "    mask = np.logical_and(mask, useGaiaData['parallax'] > 0)\n",
    "    \n",
    "    outdict = {}\n",
    "    \n",
    "    if has_RV:\n",
    "        astropy_coords = ICRS(\n",
    "            ra = useGaiaData['ra'][mask], \n",
    "            dec = useGaiaData['dec'][mask], \n",
    "            distance = useGaiaData['parallax'][mask].to(u.parsec,equivalencies=u.parallax()),\n",
    "            pm_ra_cosdec = useGaiaData['pmra'][mask],\n",
    "            pm_dec = useGaiaData['pmdec'][mask],\n",
    "            radial_velocity = useGaiaData['radial_velocity'][mask])\n",
    "\n",
    "        ## store velocity data only if we have radial velocity\n",
    "        outdict['vx'] = astropy_coords.velocity.d_x.value\n",
    "        outdict['vy'] = astropy_coords.velocity.d_y.value\n",
    "        outdict['vz'] = astropy_coords.velocity.d_z.value\n",
    "    else:\n",
    "        astropy_coords = ICRS(\n",
    "            ra = useGaiaData['ra'][mask], \n",
    "            dec = useGaiaData['dec'][mask], \n",
    "            distance = useGaiaData['parallax'][mask].to(u.parsec,equivalencies=u.parallax()))\n",
    "        \n",
    "    outdict['x'] = astropy_coords.cartesian.x.value\n",
    "    outdict['y'] = astropy_coords.cartesian.y.value\n",
    "    outdict['z'] = astropy_coords.cartesian.z.value\n",
    " \n",
    "    outdict['bp_rp'] = np.array(useGaiaData['bp_rp'])[mask]\n",
    "    outdict['phot_g_mean_mag'] = np.array(useGaiaData['phot_g_mean_mag'])[mask]\n",
    "    \n",
    "    if limiting_mag is not None:\n",
    "        key = 'phot_g_mean_mag'\n",
    "        mask = outdict[key] <= limiting_mag\n",
    "        for sub_key in keys: outdict[sub_key] = outdict[sub_key][mask]\n",
    "            \n",
    "    return outdict\n",
    "    \n",
    "def getStars(\n",
    "    path,\n",
    "    loud=False,\n",
    "    limiting_mag=None,\n",
    "    has_RV=True):\n",
    "    outdfRV = readGaiaFile(path,limiting_mag,loud=loud,has_RV = has_RV)\n",
    "    keys = list(outdfRV.keys())\n",
    "    \n",
    "    ## apply filter\n",
    "    if loud: print(outdfRV[keys[0]].size,'before')\n",
    "    for key in keys:\n",
    "\n",
    "        mask = np.isfinite(outdfRV[key])\n",
    "        if loud: print(key,np.sum(mask)/mask.size)\n",
    "        for sub_key in keys:\n",
    "            outdfRV[sub_key] = outdfRV[sub_key][mask]\n",
    "    if loud: print(outdfRV[keys[0]].size,'after')\n",
    "    \n",
    "    return_value = np.array([outdfRV[key] for key in keys])\n",
    "    return return_value\n",
    "\n",
    "def getNoRV(path): \n",
    "    return getStars(path,has_RV=False)\n",
    "\n",
    "def getRV(path): return getStars(path)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "7215c17b-6d19-4f36-a013-23190f2555dd",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(5, 1000907978)\n",
      "113.84639549255371 s elapsed\n"
     ]
    }
   ],
   "source": [
    "import time\n",
    "import multiprocessing\n",
    "init_time = time.time()\n",
    "append_dict = None\n",
    "fnames = os.listdir('GaiaSource')[:]\n",
    "fnames = ['GaiaSource/%s'%fname for fname in fnames]\n",
    "\n",
    "use_mps = True\n",
    "fn = getNoRV\n",
    "if not use_mps: output = list(map(fn,fnames))\n",
    "else: \n",
    "    with multiprocessing.Pool(min(len(fnames),multiprocessing.cpu_count())) as my_pool:\n",
    "        output = my_pool.map(fn,fnames)\n",
    "\n",
    "all_arrays = np.concatenate(output,axis=1)\n",
    "print(all_arrays.shape)\n",
    "print(time.time()-init_time,'s elapsed')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 128,
   "id": "59bd2fb0-6b6a-4744-8881-0f444402fc42",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[-2.16081105e+03, -1.04827962e+03, -2.86085416e+03, ...,\n",
       "        -4.13844543e+02, -7.47912889e+03, -4.76983938e+02],\n",
       "       [-3.23392146e+03, -1.56926545e+03, -4.27812725e+03, ...,\n",
       "        -6.60610936e+02, -1.19478193e+04, -7.63138428e+02],\n",
       "       [-6.85090309e+03, -3.32277557e+03, -9.06149110e+03, ...,\n",
       "        -1.34563275e+03, -2.43120115e+04, -1.55175937e+03],\n",
       "       ...,\n",
       "       [-2.55789514e+01,  7.99625166e-01, -7.03106557e+01, ...,\n",
       "         4.31120610e+01, -2.25918239e+02, -1.29277421e+00],\n",
       "       [ 2.00449085e+00,  2.03746319e+00,  2.42574596e+00, ...,\n",
       "         1.26631451e+00,  2.12039661e+00,  1.02278996e+00],\n",
       "       [ 1.48432560e+01,  1.45417070e+01,  1.38069162e+01, ...,\n",
       "         1.47259588e+01,  1.50139589e+01,  1.42714739e+01]])"
      ]
     },
     "execution_count": 135,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arrays"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 120,
   "id": "e96e9039-297c-4579-9d4e-9cfe3d90680d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(13.82616666666667, 'minutes estimated')"
      ]
     },
     "execution_count": 120,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(os.listdir('GaiaSource'))/10 * 2.45 / 60,'minutes estimated'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 98,
   "id": "79eee989-cd52-4a85-ac85-af103fdce916",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(12.020299999999999, 'minutes estimated')"
      ]
     },
     "execution_count": 98,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "213/1e3 * 3386 / 60 ,'minutes estimated'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "id": "f2b26579-9a68-4000-b4a2-b2e6d8b9e2f9",
   "metadata": {},
   "outputs": [],
   "source": [
    "import astropy"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "id": "198d2262-1187-470e-b161-d4685626a272",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 28124 characters]\n",
      "text/plain": [
       "<Figure size 720x480 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 22960 characters]\n",
      "text/plain": [
       "<Figure size 720x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from scipy.interpolate import interp1d\n",
    "\n",
    "def remap_nonparametrically(values,old_interval,new_interval):\n",
    "    h,_ = np.histogram(values,bins=np.linspace(*old_interval))\n",
    "    new_edges = np.linspace(*new_interval)\n",
    "    probs = np.cumsum(h)/np.sum(h)\n",
    "    probs[0] = 0\n",
    "    inverter = interp1d(probs,new_edges[1:])\n",
    "    new_values = inverter(np.random.uniform(0,1,values.shape[0]))\n",
    "    \n",
    "    sort_indices = np.argsort(values)\n",
    "    new_values = np.sort(new_values)[np.argsort(sort_indices)]\n",
    "    return new_values\n",
    "    \n",
    "    \n",
    "\n",
    "old_interval = (0,4)\n",
    "new_interval = (np.log10(2e3),5)\n",
    "\n",
    "h,edges,p = plt.hist(outdfRV['bp_rp'],bins=np.linspace(*old_interval))\n",
    "ax1 = plt.gca()\n",
    "ax2 = ax1.twiny()\n",
    "temps = remap_nonparametrically(outdfRV['bp_rp'],old_interval,new_interval)\n",
    "ax2.hist(temps,bins=np.linspace(*new_interval),histtype='step',color='C1',lw=3)\n",
    "\n",
    "ax1.set_xlabel('bp_rp')\n",
    "ax2.set_xlabel('log10(T)')\n",
    "plt.gcf().set_facecolor('white')\n",
    "plt.gcf().set_dpi(120)\n",
    "\n",
    "plt.figure()\n",
    "plt.plot(outdfRV['bp_rp'],temps,'.')\n",
    "plt.gca().set_ylabel('log10(T)')\n",
    "plt.gca().set_xlabel('bp_rp')\n",
    "plt.gcf().set_dpi(120)\n",
    "plt.gcf().set_facecolor('white')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "id": "829dc653-286a-4c44-aa7c-18fbdf3ede8d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dict_keys(['x', 'y', 'z', 'vx', 'vy', 'vz', 'bp_rp', 'phot_g_mean_mag'])"
      ]
     },
     "execution_count": 63,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "outdfRV.keys()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "id": "0991be4b-2097-406c-8cf1-017023486fa1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 1.68367381e+02,  6.53687185e+01, -7.54486191e+02],\n",
       "       [ 1.61237326e+02,  6.25836230e+01, -7.18833031e+02],\n",
       "       [ 1.88487222e+02,  7.45352916e+01, -8.42938793e+02],\n",
       "       ...,\n",
       "       [ 2.91750752e+01,  2.39391026e+02, -1.02051802e+03],\n",
       "       [ 5.62918348e+02,  4.35007267e+03, -1.85454459e+04],\n",
       "       [ 1.49357826e+01,  1.17563941e+02, -4.99866294e+02]])"
      ]
     },
     "execution_count": 64,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "coordinates = np.zeros((outdfRV['x'].shape[0],3))\n",
    "velocities = np.zeros((outdfRV['x'].shape[0],3))\n",
    "\n",
    "for i,axis in enumerate(['x','y','z']):\n",
    "    coordinates[:,i] = outdfRV[axis]\n",
    "    velocities[:,i] = outdfRV[f'v{axis}']\n",
    "coordinates"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "id": "83c495e5-a18b-4ddc-aafe-d53d03394435",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "bp_rp -0.048840523 4.6543627\n",
      "phot_g_mean_mag 4.331589 16.216284\n",
      "minus_mag -16.216284 -4.331589\n",
      "log10Temperature 3.3470547510700426 4.915392704155563\n"
     ]
    }
   ],
   "source": [
    "fields = {key:outdfRV[key] for key in ['bp_rp','phot_g_mean_mag']}\n",
    "fields['minus_mag'] = -fields['phot_g_mean_mag']\n",
    "fields['log10Temperature'] = temps\n",
    "for key,value in fields.items():\n",
    "    print(key,np.min(value),np.max(value))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "id": "c2a07d6a-f727-4266-ac76-9ebcc16ad067",
   "metadata": {},
   "outputs": [],
   "source": [
    "from firefly.data_reader import ArrayReader"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "id": "2fdde841-9f10-468b-945a-73816980c3f9",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "JSONdir: /home/abg6257/GaiaeDR3 -- 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",
      "filter/colormap/radius flags correspond to: ['bp_rp', 'phot_g_mean_mag', 'minus_mag', 'log10Temperature']\n",
      "Outputting: DR3-RV - 19264/19264 particles - 5 tracked fields\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "''"
      ]
     },
     "execution_count": 73,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "reader = ArrayReader(\n",
    "    ## don't have to pass as a list with 1 element \n",
    "    ##  if only 1 particle group\n",
    "    coordinates,\n",
    "    velocities,\n",
    "    'DR3-RV',\n",
    "    fields,\n",
    "    JSONdir='GaiaeDR3', ## if not an absolute path assumes from ~\n",
    "    clean_JSONdir=True, ## delete old files in the directory\n",
    "    write_startup=True, ## overwrite the startup file (and turn off PG append)\n",
    "    write_to_disk=False, ## whether to write to disk at the end of __init__\n",
    "    field_filter_flags=[True,True,False,True], ## flags corresponding to fields\n",
    "    field_colormap_flags=[True,True,False,True],\n",
    "    field_radius_flags=[False,False,True,False],\n",
    ")\n",
    "\n",
    "reader.settings['sizeMult']['DR3-RV'] = 1\n",
    "#reader.settings['radiusVariable']['eDR3-RV'] = 1\n",
    "\n",
    "## pick the last colormap, blackbody\n",
    "index = (256/8-1)\n",
    "reader.settings['colormap']['DR3-RV'] = (index + 0.5) * (8/256)\n",
    "reader.settings['colormapVariable']['DR3-RV'] = 2\n",
    "reader.settings['showColormap']['DR3-RV'] = True\n",
    "reader.settings['GUIExcludeList'] = [\n",
    "    'DR3-RV/dropdown/colormap',\n",
    "    'DR3-RV/colorPicker',\n",
    "    'DR3-RV/dropdown/general/radiusVariableSelector']\n",
    "\n",
    "\n",
    "reader.writeToDisk()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0667200b-40fb-4165-a0e5-1df53ef6ecde",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "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.9.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
