TeamCOMPAS / COMPAS

COMPAS rapid binary population synthesis code
http://compas.science
MIT License
64 stars 66 forks source link

Command line option ignored when a grid is used #530

Closed reinhold-willcox closed 3 years ago

reinhold-willcox commented 3 years ago

Describe the bug The issue described here is very specific to a single command line option, but may be a more general trend (I haven't tested other flags).

I want to do a run with ESCN kicks set to 0, while also using a grid file. When both flags are set, the ECSN kicks are not set to 0. However, when the same grid arguments are included on the command line, the ECSN kicks are properly zero'd.

Label the issue urgency_moderate - This is a moderately urgent issue severity_moderate - This is a moderately severe bug

To Reproduce

For the purposes of a minimum working example, the following single lined gridfile was used to produce a system which will ECSN.

 --random-seed 6 --initial-mass-1 7.926799769578849 --semi-major-axis 31.43376315763422 --initial-mass-2 1.540423527044136 --metallicity 0.0142 --eccentricity 0    

Then the following commands are run:

$ COMPAS --kick-magnitude-sigma-ECSN 0 --grid grid.txt
$ COMPAS --kick-magnitude-sigma-ECSN 0  $(< grid.txt) -n 1

where the -n 1 is required because without the grid Compas will run the same binary 10x.

A useful python script to quickly see the drawn ECSN kick of this system is:

import h5py as h5    
import sys     

myf = h5.File(sys.argv[1], 'r')    
SNe = myf['BSE_Supernovae']    
sntype = SNe['SN_Type(SN)'][()]    
drnKick= SNe['Drawn_Kick_Magnitude(SN)'][()]    

print("The ECSN kick is {}.".format(drnKick[sntype == 2])) 

With commands and output:

$ py test_ecsn.py COMPAS_Output/COMPAS_Output.h5 
The ECSN kick is [36.6312464].
$ py test_ecsn.py COMPAS_Output_1/COMPAS_Output.h5 
The ECSN kick is [0.].

It is apparent that the use of a grid file negates the use of the ECSN flag. I'm not sure if this applies to other flags as well.

Expected behavior The existence of the grid file should not override the command line args.

Versioning (please complete the following information):

jeffriley commented 3 years ago

The issue here was case-sensitive vs case-insensitive matches (asking BOOST to do case-insensitive matches for option names doesn't propagate to all matches BOOST does...)

Fixed in v02.18.08, PR #534