def run( post_name: str, selected_stars: List[StarDescription], len_vsx: int, reference_frame: Path, resultdir: str, explore: bool, ): sitedir = f"{os.getcwd()}/site/vsx/" images_prefix = f"/images/{post_name}/" # copy_files(post_name, resultdir, sitedir) staticimagesdir = f"{sitedir}static/{images_prefix}" selective_copy_files(selected_stars, staticimagesdir, resultdir) result = get_header(post_name, reference_frame.name) result += get_starfile_preamble( images_prefix, len([x for x in selected_stars if not x.has_metadata("VSX")]), len_vsx, get_optional_preamble(images_prefix, staticimagesdir), ) sorted_stars = utils.sort_selected(selected_stars) part_block = partial(block, resultdir=resultdir, images_prefix=images_prefix, explore=explore) for star in sorted_stars: result += part_block(star) postdir = f"{sitedir}/content/posts/{post_name}/" create_dir(postdir) with open(f"{postdir}/{post_name}.md", "w") as outfile: outfile.write(result)
def clean_and_create_resultdir(argsdir: str, vastdir: str): resultdir = utils.add_trailing_slash( argsdir) if argsdir is not None else vastdir # if resultdir does not exist, create it if not os.path.isdir(resultdir): logging.info( f"The resultdir '{resultdir}' does not exist, creating it...") reading.create_dir(resultdir) return resultdir
def perform_photometry(configfilelist, chosen_files, offset=1): # filestring = ' '.join(chosen_files) logging.debug(f"Perform photometry {chosen_files}, {configfilelist}") for id, entry in enumerate(configfilelist): logging.debug(f"Perform photometry {id} {entry}") outputdir = f'{settings.testdir}{id + offset:05d}/' create_dir(outputdir) main_muniwin.write_photometry(config_file=entry, files=chosen_files, outputdir=outputdir)
def generate_photometry_config_files(): logging.info("Generating photometry config files...") create_dir(settings.testdir + 'conf') result = [] counter = 0 for fwhm in np.arange(1, 8, 0.5): for thresh in range(1, 8, 1): counter += 1 filename = f'{settings.testdir}conf/muniphot{counter}.conf' write_photometry_config(filename, apertures, maxstar, fwhm, thresh, gain, skyinner, skyouter) result.append(filename) logging.info(f"{len(result)} config files generated.") return result
def perform_matching(configfilelist, all_photometry_files, reference_frame, offset=1): input_file_string = ' '.join(all_photometry_files) # either read the previous reference frame or calculate a new one logging.debug(f"Perform photometry {input_file_string}, {configfilelist}") for id, entry in enumerate(configfilelist): logging.debug(f"Perform photometry {id} {entry}") outputdir = f'{settings.testdir}match{id + offset:05d}/' create_dir(outputdir) logging.info("========================================") for photfile in all_photometry_files: main_muniwin.write_match(photfile, reference_frame, config_file=entry, to_match_is_full_path=True, outputdir=outputdir)