Skip to content

Commit

Permalink
Merge pull request #314 from SNEWS2/JostMigenda/AnalyticFluence
Browse files Browse the repository at this point in the history
Improved default path in AnalyticFluence.ipynb
  • Loading branch information
JostMigenda authored Apr 26, 2024
2 parents e09aa61 + 6a001ec commit ef94617
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions doc/nb/AnalyticFluence.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,17 @@
"import matplotlib as mpl\n",
"import numpy as np\n",
"\n",
"from snewpy import snowglobes\n",
"from snewpy import snowglobes, model_path\n",
"from snewpy.neutrino import Flavor\n",
"from snewpy.models import Analytic3Species\n",
"from snewpy.models.ccsn import Analytic3Species\n",
"\n",
"mpl.rc('font', size=14)\n",
"\n",
"SNOwGLoBES_path = None # change to SNOwGLoBES directory if using a custom detector configuration\n",
"SNEWPY_models_base = \"/path/to/snewpy/models/\" # change to local directory where models are located\n",
"\n",
"model_folder = f\"{SNEWPY_models_base}/AnalyticFluence/\"\n",
"try:\n",
" os.mkdir(model_folder)\n",
"except OSError as e:\n",
" print(model_folder)\n",
" print(f\"Folder {model_folder} already exists or path is wrong\")\n",
"else:\n",
" print(f\"Created folder {model_folder}\")\n"
"\n",
"model_folder = f\"{model_path}/AnalyticFluence/\"\n",
"os.makedirs(model_folder, exist_ok=True)\n",
"print(f\"Using folder `{model_folder}`.\")"
]
},
{
Expand Down Expand Up @@ -97,7 +91,7 @@
" print(\"incorrect second moment method: rms or pinch\")\n",
"\n",
"filename = \"AnalyticFluence_demo.dat\"\n",
"table.write(model_folder+\"/\"+filename,format='ascii',overwrite=True)"
"table.write(model_folder + filename, format='ascii', overwrite=True)"
]
},
{
Expand All @@ -115,7 +109,7 @@
"source": [
"%matplotlib inline\n",
"filename = \"AnalyticFluence_demo.dat\"\n",
"model = Analytic3Species(model_folder+\"/\"+filename)\n",
"model = Analytic3Species(model_folder + filename)\n",
"flavors = [Flavor.NU_E,Flavor.NU_E_BAR,Flavor.NU_X]\n",
"\n",
"fig,axes = plt.subplots(1,3,figsize=(16,3))\n",
Expand Down

0 comments on commit ef94617

Please sign in to comment.