Example #1
0
def initialize_cluster(name="", obsids=[], abundance=0.3, redshift=0.0, nH=0.0):
    clstr = cluster.ClusterObj(name=name, observation_ids=obsids, abundance=abundance,
                               redshift=redshift, hydrogen_column_density=nH,
                               data_directory=config.data_directory())
    print('Making initial cluster directory: {}'.format(clstr.directory))
    io.make_directory(clstr.directory)
    io.make_initial_directories(clstr)
    clstr.last_step_completed = 1
    print("Downloading cluster data.")
    download_data(clstr)
    clstr.last_step_completed = 2
    print("Merging observations.")
    merge_observations(clstr)
    clstr.last_step_completed = 3
Example #2
0
def automated_cluster_init(batch_file):
    print("Automated cluster initialization using: {batch_file}".format(batch_file=batch_file))
    data_directory = config.data_directory()
    csv_clusters = io.get_cluster_info_from_csv(batch_file)
    for clstr in csv_clusters:
        cluster_obj = cluster.ClusterObj(name=clstr['name'],
                                         observation_ids=clstr['obsids'],
                                         data_directory=data_directory,
                                         abundance=clstr['abundance'],
                                         redshift=clstr['redshift'],
                                         hydrogen_column_density=clstr['hydrogen_column_density']
                                         )

        io.make_directory(cluster_obj.directory)
        cluster_obj.write_cluster_data()
        io.make_initial_directories(cluster_obj)
        cluster_obj.last_step_completed = 1
        download_data(cluster_obj)
        cluster_obj.last_step_completed = 2
        merge_observations(cluster_obj)
        cluster_obj.last_step_completed = 3
    parser.add_argument("--remove_sources", "-r", dest="remove_sources", action='store_true',
                        help="Remove sources given the supplied region file.")

    parser.add_argument("--continue", dest='cont', action='store_true',
                        help='Continue where you left off (must also specify --config_file)')

    parser.add_argument("--batch_init", '-b', dest="batch_file", action='store', default="",
                        help="Supply a CSV file with the relevant meta data for batch processing."
                        "See documentation for full usage instructions.")

    parser.add_argument("--nH", dest='nH', action='store', default=None)
    parser.add_argument("--redshift", '-z', dest='redshift', action='store', default=None)
    parser.add_argument('--cluster_name', '-n', dest='name', action='store', default=None)
    parser.add_argument('--obsids', dest='obsids', action='store', nargs='+', default=None)
    parser.add_argument('--abundance', dest='abundance', action='store', default=None)
    args = parser.parse_args()

    # logger.debug("Finished getting commandline arguments")

    return args




if __name__ == "__main__":
    if 1 == len(sys.argv):
        menu.make_menu()
    else:
        cluster_obj = cluster.ClusterObj()
        args = process_commandline_arguments(cluster_obj)
Example #4
0
def initialize_cluster():
    new_cluster = cluster.ClusterObj()
    new_cluster.initialize_cluster()
    config.set_current_cluster(new_cluster)