-
Notifications
You must be signed in to change notification settings - Fork 2
Adds ENDF/B-VII.1 (emission probability and half-life) data and JEFF-3.1.1 (cumulative fission yield) data #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ee54801
82fab1c
8ecfe91
0df4c67
e7170c9
5c5288a
58844f9
3b32a9c
09c4608
f293ed5
152b468
c19d85a
6c8bd5b
cec5991
afc65ff
1c88bf3
2156f9a
e46fad1
76f50df
206915d
ccc9d46
80871f5
380cb96
6d70e31
00bf9b0
9b500b8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ roman_to_int() { | |
| } | ||
|
|
||
| DATA_DIR="mosden/data/unprocessed" | ||
| mkdir -p "$DATA_DIR" | ||
|
|
||
| # ENDF -------------------------------------------------------------------- | ||
| ENDF_VERSION="VII.1" | ||
|
|
@@ -29,8 +30,6 @@ if [[ ! " ${ALLOWED_VERSIONS[*]} " =~ " ${ENDF_VERSION} " ]]; then | |
| exit 1 | ||
| fi | ||
|
|
||
| mkdir -p "$DATA_DIR" | ||
|
|
||
| LOWERCASE_VERSION=$(echo "${ENDF_VERSION//./}" | tr '[:upper:]' '[:lower:]') | ||
|
|
||
| ROMAN_PART="${LOWERCASE_VERSION//[0-9]/}" | ||
|
|
@@ -40,27 +39,80 @@ LOWERCASE_VERSION="${INTEGER_VALUE}${DIGIT_PART}" | |
|
|
||
| ENDF_DIR="${DATA_DIR}/endfb${LOWERCASE_VERSION}" | ||
| NFY_DIR="${ENDF_DIR}" | ||
| decay_DIR="${ENDF_DIR}" | ||
| mkdir -p "$NFY_DIR" | ||
|
|
||
| if [[ "${ENDF_VERSION}" == "VII.1" ]]; then | ||
| SEPARATOR="-" | ||
| decay_SEPARATOR="-" | ||
| elif [[ "${ENDF_VERSION}" == "VIII.0" ]]; then | ||
| SEPARATOR="_" | ||
| decay_SEPARATOR="_" | ||
| fi | ||
|
|
||
| NFY_ZIP_NAME="ENDF-B-${ENDF_VERSION}${SEPARATOR}nfy.zip" | ||
| NFY_URL="https://www.nndc.bnl.gov/endf-b7.1/zips/${NFY_ZIP_NAME}" | ||
| NFY_URL="https://www.nndc.bnl.gov/endf-b${INTEGER_VALUE}.${DIGIT_PART}/zips/${NFY_ZIP_NAME}" | ||
|
|
||
| echo "Downloading NFY data for ENDF/B-${ENDF_VERSION}..." | ||
| TEMP_ZIP="${NFY_DIR}/${NFY_ZIP_NAME}" | ||
| echo "Accessing ${NFY_URL}" | ||
| wget --show-progress -O "$TEMP_ZIP" "$NFY_URL" | ||
| echo "Extracting NFY data..." | ||
| unzip "$TEMP_ZIP" -d "$NFY_DIR" | ||
| rm "$TEMP_ZIP" | ||
| echo "NFY data handled" | ||
|
|
||
| decay_ZIP_NAME="ENDF-B-${ENDF_VERSION}${decay_SEPARATOR}decay.zip" | ||
| decay_URL="https://www.nndc.bnl.gov/endf-b${INTEGER_VALUE}.${DIGIT_PART}/zips/${decay_ZIP_NAME}" | ||
|
|
||
| echo "Downloading decay data for ENDF/B-${ENDF_VERSION}..." | ||
| TEMP_ZIP="${decay_DIR}/${decay_ZIP_NAME}" | ||
| echo "Accessing ${decay_URL}" | ||
| wget --show-progress -O "$TEMP_ZIP" "$decay_URL" | ||
| echo "Extracting decay data..." | ||
| unzip "$TEMP_ZIP" -d "$decay_DIR" | ||
| rm "$TEMP_ZIP" | ||
| echo "Decay data handled" | ||
|
|
||
| # /ENDF -------------------------------------------------------------------- | ||
|
|
||
|
|
||
|
|
||
| # JEFF -------------------------------------------------------------------- | ||
| JEFF_VERSION="3.1.1" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How come JEFF only works as version 3.1.1?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's just the only version I've added so far! In a later PR I'll likely be adding more data |
||
| ALLOWED_VERSIONS=("3.1.1") | ||
|
|
||
| if [[ ! " ${ALLOWED_VERSIONS[*]} " =~ " ${JEFF_VERSION} " ]]; then | ||
| echo "Error: Invalid JEFF version '${JEFF_VERSION}'" | ||
| echo "Allowed versions: ${ALLOWED_VERSIONS[*]}" | ||
| exit 1 | ||
| fi | ||
| JEFF_VERSION_NOP="${JEFF_VERSION//./}" | ||
|
|
||
| JEFF_DIR="${DATA_DIR}/jeff${JEFF_VERSION_NOP}" | ||
| NFY_DIR="${JEFF_DIR}/nfpy/" | ||
| mkdir -p "$NFY_DIR" | ||
| echo "Saving data to ${NFY_DIR}" | ||
|
|
||
| if [[ "${JEFF_VERSION}" == "3.1.1" ]]; then | ||
| JEFF_URL="https://www-nds.iaea.org/public/download-endf/JEFF-${JEFF_VERSION}/nfpy/" | ||
| fi | ||
|
|
||
|
|
||
| echo "Downloading NFY data for JEFF-${JEFF_VERSION}..." | ||
| echo "Accessing ${JEFF_URL}" | ||
| wget --show-progress --recursive --no-parent --accept "*.zip" --no-host-directories --cut-dirs=3 -P "${JEFF_DIR}" "$JEFF_URL" | ||
| echo "Extracting NFY data..." | ||
| for f in "$NFY_DIR"/*.zip; do | ||
| unzip "$f" -d "$NFY_DIR" | ||
| done | ||
| echo "Removing zip files..." | ||
| rm "$NFY_DIR"/*.zip | ||
| echo "NFY data handled" | ||
|
|
||
|
|
||
| # /JEFF -------------------------------------------------------------------- | ||
|
|
||
| # IAEA -------------------------------------------------------------------- | ||
| IAEA_DIR="${DATA_DIR}/iaea" | ||
| IAEA_FILE="$IAEA_DIR/eval.csv" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| {} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| { | ||
| "name": "IAEA", | ||
| "file_options": { | ||
| "overwrite": { | ||
| "preprocessing": true, | ||
| "concentrations": true, | ||
| "count_rate": true, | ||
| "group_fitting": true, | ||
| "postprocessing": true, | ||
| "logger": true | ||
| }, | ||
| "unprocessed_data_dir": "/home/luke/github/mosden/mosden/data/unprocessed/", | ||
| "log_level": 20 | ||
| }, | ||
| "data_options": { | ||
| "half_life": "iaea/eval.csv", | ||
| "cross_section": "", | ||
| "emission_probability": "iaea/eval.csv", | ||
| "fission_yield": "jeff311/nfpy/", | ||
| "decay_time_spacing": "log", | ||
| "temperature_K": 920, | ||
| "density_g_cm3": 2.3275, | ||
| "energy_MeV": 0.0253e-6, | ||
| "fissile_fractions": { | ||
| "U235": 1.0 | ||
| } | ||
| }, | ||
| "modeling_options": { | ||
| "parent_feeding": false, | ||
| "concentration_handling": "CFY", | ||
| "count_rate_handling": "data", | ||
| "reprocessing_locations": ["excore"], | ||
| "reprocessing": { | ||
| "Xe": 0.0 | ||
| }, | ||
| "irrad_type": "saturation", | ||
| "incore_s": 10, | ||
| "excore_s": 0, | ||
| "net_irrad_s": 420, | ||
| "decay_time": 1200, | ||
| "num_decay_times": 800 | ||
| }, | ||
| "group_options": { | ||
| "num_groups": 6, | ||
| "method": "nlls", | ||
| "samples": 5000, | ||
| "sample_func": "normal" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| { | ||
| "name": "ENDFB71 Data", | ||
| "file_options": { | ||
| "overwrite": { | ||
| "preprocessing": true, | ||
| "concentrations": true, | ||
| "count_rate": true, | ||
| "group_fitting": true, | ||
| "postprocessing": true, | ||
| "logger": true | ||
| }, | ||
| "unprocessed_data_dir": "/home/luke/github/mosden/mosden/data/unprocessed/", | ||
| "processed_data_dir": "/home/luke/github/mosden/examples/pure_endfb71/", | ||
| "output_dir": "/home/luke/github/mosden/examples/pure_endfb71/", | ||
| "log_level": 20, | ||
| "log_file": "/home/luke/github/mosden/examples/pure_endfb71/log.log" | ||
|
Comment on lines
+12
to
+16
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will these directory lines later be changed to a standardized format?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, this raises a good point. The default arguments are available (if the user does not provide a parameter) that can auto-fill these parameters with the correct path for users, so the only reason to include this is to demonstrate that these parameters are available. I think for now this could be left as-is, but I will create an issue (#40) that will:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, sounds like a good plan. |
||
| }, | ||
| "data_options": { | ||
| "half_life": "endfb71/decay/", | ||
| "cross_section": "", | ||
| "emission_probability": "endfb71/decay/", | ||
| "fission_yield": "endfb71/nfy/", | ||
| "decay_time_spacing": "log", | ||
| "temperature_K": 920, | ||
| "density_g_cm3": 2.3275, | ||
| "energy_MeV": 0.0253e-6, | ||
| "fissile_fractions": { | ||
| "U235": 1.0 | ||
| } | ||
| }, | ||
| "modeling_options": { | ||
| "parent_feeding": false, | ||
| "concentration_handling": "CFY", | ||
| "count_rate_handling": "data", | ||
| "reprocessing_locations": ["excore"], | ||
| "reprocessing": { | ||
| "Xe": 0.0 | ||
| }, | ||
| "irrad_type": "saturation", | ||
| "incore_s": 10, | ||
| "excore_s": 0, | ||
| "net_irrad_s": 420, | ||
| "decay_time": 1200, | ||
| "num_decay_times": 800 | ||
| }, | ||
| "group_options": { | ||
| "num_groups": 6, | ||
| "method": "nlls", | ||
| "samples": 5000, | ||
| "sample_func": "normal" | ||
| }, | ||
| "post_options": { | ||
| "sensitivity_subplots": true | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ | |
| from time import time | ||
| import warnings | ||
| from tqdm import tqdm | ||
| from scipy.linalg import svd | ||
|
|
||
|
|
||
| class Grouper(BaseClass): | ||
|
|
@@ -97,6 +98,7 @@ def _residual_function( | |
| parameters: np.ndarray[float], | ||
| times: np.ndarray[float], | ||
| counts: np.ndarray[float], | ||
| count_err: np.ndarray[float], | ||
| fit_func: Callable) -> float: | ||
| """ | ||
| Calculate the residual of the current set of parameters | ||
|
|
@@ -108,7 +110,9 @@ def _residual_function( | |
| times : np.ndarray[float] | ||
| List of times | ||
| counts : np.ndarray[float] | ||
| List of nominal times | ||
| List of delayed neutron counts | ||
| count_err : np.ndarray[float] | ||
| List of count errors | ||
| fit_func : Callable | ||
| Function that takes times and parameters to return list of counts | ||
|
|
||
|
|
@@ -117,7 +121,7 @@ def _residual_function( | |
| residual : float | ||
| Value of the residual | ||
| """ | ||
| residual = (counts - fit_func(times, parameters)) / (counts + 1e-12) | ||
| residual = (counts - fit_func(times, parameters)) / (counts) | ||
| return residual | ||
|
|
||
| def _pulse_fit_function(self, | ||
|
|
@@ -267,20 +271,24 @@ def _nonlinear_least_squares(self, | |
| xtol=1e-12, | ||
| verbose=0, | ||
| max_nfev=1e5, | ||
| args=(times, counts, fit_function)) | ||
|
|
||
| args=(times, counts, count_err, fit_function)) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you have docstrings for this function? I am not seeing anything...
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good question! It isn't visible in the difference, but the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, my bad, I misread the code thinking this was a new function not a function call. |
||
| J = result.jac | ||
| s = svd(J, compute_uv=False) | ||
| condition_number = s[0] / s[-1] | ||
| self.logger.info(f'{condition_number = }') | ||
| sampled_params: list[float] = list() | ||
| tracked_counts: list[float] = list() | ||
| sorted_params = self._sort_params_by_half_life(result.x) | ||
| sampled_params.append(sorted_params) | ||
| countrate = CountRate(self.input_path) | ||
| self.logger.info(f'Currently using {self.sample_func} sampling') | ||
| for _ in tqdm(range(1, self.MC_samples), desc='Solving least-squares'): | ||
| data = countrate.calculate_count_rate( | ||
| MC_run=True, sampler_func=self.sample_func) | ||
| count_sample = data['counts'] | ||
| with warnings.catch_warnings(): | ||
| warnings.simplefilter('ignore') | ||
| data = countrate.calculate_count_rate( | ||
| MC_run=True, sampler_func=self.sample_func) | ||
| count_sample = data['counts'] | ||
| count_sample_err = data['sigma counts'] | ||
| result = least_squares( | ||
| self._residual_function, | ||
| result.x, | ||
|
|
@@ -294,6 +302,7 @@ def _nonlinear_least_squares(self, | |
| args=( | ||
| times, | ||
| count_sample, | ||
| count_sample_err, | ||
| fit_function)) | ||
| tracked_counts.append([i for i in count_sample]) | ||
| sorted_params = self._sort_params_by_half_life(result.x) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where are INTEGER_VALUE and DIGIT_PART coming from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
INTEGER_VALUEcomes from line 37, and translates the roman numeral to an integer value. TheDIGIT_PARTcomes from line 36, and just extracts the number after the period so that it is generically formatted (enabling using of different ENDF data)