Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
args = parser.parse_args()
if args.version:
from ._version import __version__
print('pyMARS {version} from {path} ()'.format(
version=__version__,
path=os.path.abspath(os.path.dirname(__file__))))
sys.exit(0)
if args.convert:
if not args.model:
parser.error('Conversion requires specifying a model file.')
# Convert model and exit
files = convert(args.model, args.thermo, args.transport, args.path)
if isinstance(files, list):
logging.info('Converted files: ' + ' '.join(files))
else:
logging.info('Converted file: ' + files)
else:
if not args.input:
parser.error('A YAML input file needs to be specified using -i or --input')
with open(args.input, 'r') as the_file:
input_dict = yaml.safe_load(the_file)
inputs = parse_inputs(input_dict)
# Check for Chemkin format and convert if needed
if os.path.splitext(args.model)[1] != '.cti':
logging.info('Chemkin file detected; converting before reduction.')
logging.info('Converted files: ' + ' '.join(files))
else:
logging.info('Converted file: ' + files)
else:
if not args.input:
parser.error('A YAML input file needs to be specified using -i or --input')
with open(args.input, 'r') as the_file:
input_dict = yaml.safe_load(the_file)
inputs = parse_inputs(input_dict)
# Check for Chemkin format and convert if needed
if os.path.splitext(args.model)[1] != '.cti':
logging.info('Chemkin file detected; converting before reduction.')
args.model = convert(args.model, args.thermo, args.transport, args.path)
main(
inputs.model, inputs.error,
inputs.ignition_conditions, inputs.psr_conditions, inputs.flame_conditions,
method=inputs.method, target_species=inputs.target_species,
safe_species=inputs.safe_species, phase_name=inputs.phase_name,
run_sensitivity_analysis=inputs.sensitivity_analysis,
upper_threshold=inputs.upper_threshold, sensitivity_type=inputs.sensitivity_type,
path=args.path, num_threads=args.num_threads
)
logging.shutdown()