Skip to content

Commit bb7ac24

Browse files
authored
Merge pull request #569 from TeamCOMPAS/defect-fix
Defect Repair
2 parents b489871 + a0a1685 commit bb7ac24

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed

postProcessing/Folders/H5/PythonScripts/h5view.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,9 @@ def printSummary(h5name = None, h5file = None, excludeList = ''):
208208

209209
else: # assume COMPAS_Output file
210210

211-
print(('\n{:<' + str(maxFilenameLen) + '} {:<' + str(max(7, widthColumns)) + '} {:<' + str(max(7, widthEntries)) + '}')
212-
.format('COMPAS Filename', 'Columns', 'Entries'))
213-
print('-'*(maxFilenameLen), ' ', '-'*(max(7, widthColumns)), ' ', '-'*(max(7, widthEntries)))
211+
print(('\n{:<' + str(maxFilenameLen) + '} {:<' + str(max(7, widthColumns)) + '} {:<' + str(max(7, widthEntries)) + '} {:<' + str(max(12, widthEntries)) + '}')
212+
.format('COMPAS Filename', 'Columns', 'Entries', 'Unique SEEDs'))
213+
print('-'*(maxFilenameLen), ' ', '-'*(max(7, widthColumns)), ' ', '-'*(max(7, widthEntries)), ' ', '-'*(max(12, widthEntries)))
214214

215215
# do Run_Details file first
216216
if not Run_Details_Filename in excludeList: # ... if not excluded
@@ -222,8 +222,13 @@ def printSummary(h5name = None, h5file = None, excludeList = ''):
222222
if group in excludeList: continue # skip if excluded
223223
if group == Run_Details_Filename: continue # Run_details already done (or excluded)
224224

225-
print(('{:<' + str(maxFilenameLen) + '} {:>' + str(max(7, widthColumns)) + '} {:>' + str(max(7, widthEntries)) + '}')
226-
.format(group, len(h5file[group].keys()), groupMaxEntries[gIdx]))
225+
try:
226+
uniqueSeedsStr = str(len(np.unique(h5file[group]['SEED'])))
227+
except Exception as e:
228+
uniqueSeedsStr = " "
229+
230+
print(('{:<' + str(maxFilenameLen) + '} {:>' + str(max(7, widthColumns)) + '} {:>' + str(max(7, widthEntries)) + '} {:>' + str(max(12, widthEntries)) + '}')
231+
.format(group, len(h5file[group].keys()), groupMaxEntries[gIdx], uniqueSeedsStr))
227232

228233
print('\n')
229234

@@ -716,7 +721,7 @@ def main():
716721
parser.add_argument('inputPaths', metavar = 'input', type = str, nargs = '+', help = 'input directory and/or file name(s)')
717722
parser.add_argument('-f', '--filter', dest = 'filename_filter', type = str, action = 'store', default = '*', help = 'input filename filter (default = *)')
718723
parser.add_argument('-r', '--recursive', dest = 'recursion_depth', type = int, nargs = '?', action = 'store', default = 0, const = sys.maxsize, help = 'recursion depth (default is no recursion)')
719-
parser.add_argument('-S', '--summary', dest = 'summary', action = 'store_true', default = False, help = 'display summary output for HDF5 file (default is not to displat summary)')
724+
parser.add_argument('-S', '--summary', dest = 'summary', action = 'store_true', default = False, help = 'display summary output for HDF5 file (default is not to display summary)')
720725
parser.add_argument('-H', '--headers', dest = 'headers', action = 'store_true', default = False, help = 'display file headers for HDF5 file (default is not to display headers)')
721726
parser.add_argument('-C', '--contents', dest = 'contents', type = int, nargs = '?', action = 'store', default = 0, const = sys.maxsize, help = 'display file contents for HDF5 file: argument is number of entries (+ve from top, -ve from bottom) (default is not to display contents)')
722727
parser.add_argument('-s', '--stop-on-error', dest = 'stop_on_error', action = 'store_true', default = False, help = 'stop all copying if an error occurs (default is skip to next file and continue)')

src/changelog.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,8 +745,12 @@
745745
// - Avoid possibility of exceeding total mass in Farmer PPISN prescription
746746
// 02.19.03 TW - May 18, 2021 - Enhancement:
747747
// - Change default LBV wind prescription to HURLEY_ADD
748+
// 02.19.04 JR - May 24, 2021 - Defect Repair:
749+
// - Fixed incrementing of random seed and binary id when grid file contains sets/ranges
750+
//
751+
// Modified h5view.py (in postProcessing/Folders/H5/PythonScripts) to print number of unique seeds (where relevant) in summary output
748752

749753

750-
const std::string VERSION_STRING = "02.19.03";
754+
const std::string VERSION_STRING = "02.19.04";
751755

752756
# endif // __changelog_h__

src/main.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -440,18 +440,18 @@ std::tuple<int, int> EvolveBinaryStars() {
440440

441441
unsigned long int randomSeed = 0l;
442442

443+
long int thisId = index + gridLineVariation; // set the id for the binary
444+
443445
if (OPTIONS->FixedRandomSeedGridLine()) { // user specified a random seed in the grid file for this star?
444446
randomSeed = RAND->Seed(OPTIONS->RandomSeedGridLine() + (long int)gridLineVariation); // yes - use it (indexed)
445447
}
446448
else if (OPTIONS->FixedRandomSeedCmdLine()) { // no - user specified a random seed on the commandline?
447-
randomSeed = RAND->Seed(OPTIONS->RandomSeedCmdLine() + (long int)index); // yes - use it (indexed)
449+
randomSeed = RAND->Seed(OPTIONS->RandomSeedCmdLine() + thisId); // yes - use it (indexed)
448450
}
449451
else { // no
450-
randomSeed = RAND->Seed(RAND->DefaultSeed() + (long int)index); // use default seed (based on system time) + id (index)
452+
randomSeed = RAND->Seed(RAND->DefaultSeed() + thisId); // use default seed (based on system time, and indexed)
451453
}
452454

453-
long int thisId = OPTIONS->FixedRandomSeedGridLine() ? index + gridLineVariation : index; // set the id for the binary
454-
455455
delete binary; binary = nullptr; // so we don't leak
456456
binary = new BinaryStar(randomSeed, thisId); // generate binary according to the user options
457457

0 commit comments

Comments
 (0)