Generating Pre-Main Sequence Models Script
This script is designed to generate pre-main sequence models for a given range of stellar masses and chemical composition. It uses the Python libraries numpy for numeric operations, such as generating a range of masses, and argparse for parsing command line arguments. The user provides a path to a chemical composition file, a range of masses (low, high, and step), and optionally, an output directory and a composition name to use in the models. The script integrates functionalities from the 'pysep' library to open, parse the chemical composition file, and generate the pre-main sequence models accordingly.
from pysep.opac.tops import open_and_parse from pysep.newpoly.popFileToPolyModel import generate_prems_models from numpy import arange import argparse if __name__ == "__main__": parser = argparse.ArgumentParser(description="Generate pre mainsequence models given a chemical composition file for a range of masses") parser.add_argument("path", help="path to chemical composition file", type=str) parser.add_argument("mlow", help="low mass range of pre main sequence models to generate", type=float) parser.add_argument("mhigh", help="high mass range of pre main sequence models to generate", type=float) parser.add_argument("mstep", help="step size betweem pre main sequence masse", type=float) parser.add_argument("-o", "--output", help="directory to output pre main sequence models too", type=str, default=".") parser.add_argument("-c", "--compName", help="Composition name to use in the premain sequence model", type=str, default="comp") args = parser.parse_args() masses = arange(args.mlow, args.mhigh, args.mstep) parsed = open_and_parse(args.path) generate_prems_models(parsed, masses, args.output, compName=args.compName, DDAGE=1000)