Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 8 additions & 31 deletions compare.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -197,35 +197,12 @@
"metadata": {},
"outputs": [],
"source": [
"# TODO consider replacing with pypact\n",
"def read_irr_setup(filepath):\n",
" lines = open(filepath).readlines()\n",
" days_list = []\n",
" flux_mag_list = []\n",
" for line in lines:\n",
" spl = line.strip().split()\n",
" if 'FLUX' in line:\n",
" assert(len(spl) == 2)\n",
" flux_mag = float(spl[1])\n",
" if 'TIME' in line:\n",
" time_indx = spl.index('TIME')\n",
" time_num = float(spl[time_indx+1])\n",
" unit = spl[time_indx+2]\n",
" if unit == 'ATOMS':\n",
" time_num = time_num / (3600*24)\n",
" elif unit == 'MINS':\n",
" time_num = time_num / (60*24)\n",
" elif unit == 'HOURS':\n",
" time_num = time_num / (24)\n",
" elif unit == 'DAYS':\n",
" time_num = time_num\n",
" elif unit == 'YEARS':\n",
" time_num = time_num * 365.25\n",
" else:\n",
" raise ValueError('Unrecognized unit [%s]' %unit)\n",
" \n",
" days_list.append(time_num)\n",
" flux_mag_list.append(flux_mag)\n",
" ff = pp.InputData()\n",
" pp.from_file(ff, filepath)\n",
" cleaned_irradschedule = [item for item in ff._irradschedule if item != (0.0, 0.0)]\n",
" flux_mag_list = [val[1] for val in cleaned_irradschedule] + [0.0] * len(ff._coolingschedule)\n",
" days_list = np.cumsum([val[0] for val in cleaned_irradschedule] + ff._coolingschedule)/ (24*60*60)\n",
" return days_list, flux_mag_list\n",
"\n",
"def read_mat_setup(filepath):\n",
Expand All @@ -246,15 +223,15 @@
" input_path = here / k / ('TENDL-2017_' + exp + '.i')\n",
" input_path = str(input_path.absolute())\n",
" days, flux_mag = read_irr_setup(input_path)\n",
" days = np.cumsum(days)\n",
" mass_dict = {k:v/100 for k,v in read_mat_setup(input_path)}\n",
" setup_dict['days'][k][exp] = days\n",
" setup_dict['flux_mag'][k][exp] = flux_mag\n",
" setup_dict['mass'][k][exp] = mass_dict\n",
" setup_dict['density'][k][exp] = read_density(input_path)\n",
" assert(len(days) == len(flux_mag))\n",
" assert(isinstance(mass_dict, dict))\n",
"\n",
" \n",
" \n",
"setup_dict['mg_flux'] = flux_dict\n",
"setup_dict['ebins'] = ebins"
]
Expand Down Expand Up @@ -613,7 +590,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.0rc1"
"version": "3.11.0"
}
},
"nbformat": 4,
Expand Down
Loading