def selective_copy_files(stars: List[StarDescription], destdir: str, resultdir: str): trash_and_recreate_dir(destdir) for astar in stars: copy(astar.result["phase"], destdir) if "phase" in astar.result else None copy(astar.result["compstars"], destdir) if "compstars" in astar.result else None copy(astar.result["compA"], destdir) if "compA" in astar.result else None copy(astar.result["compB"], destdir) if "compB" in astar.result else None copy(astar.result["light"], destdir) if "light" in astar.result else None copy(astar.result["lightpa"], destdir) if "lightpa" in astar.result else None copy(astar.result["lightcont"], destdir) if "lightcont" in astar.result else None copy(astar.result["aavso"], destdir) if "aavso" in astar.result else None fieldcharts = f"{resultdir}fieldcharts/*.png" fieldcharts_glob = glob.glob(fieldcharts) logging.info( f"Copying {len(fieldcharts_glob)} field charts from {fieldcharts}...") for file in fieldcharts_glob: copy(file, destdir) copy(f"{resultdir}selected_radec.txt", destdir) copy(f"{resultdir}selected_localid.txt", destdir) copy(f"{resultdir}aavso_vsx.txt", destdir) logging.info(f"Copying done.")
def run_standard_field_charts(vsx_star_descr, wcs): trash_and_recreate_dir(settings.fieldchartsdirs) # reference_frame, reference_frame_index=reading.read_reference_frame() # reference_fits_frame=settings.convfitsdir+reference_frame reference_fits_frame=settings.reference_header SHOW_UPSILON = False # if SHOW_UPSILON: # candidates = do_calibration.get_candidates(0.5) # TODO hand labeled stars # hand_candidates_descr = do_calibration.get_star_descriptions(init.wwcra_certain_candidates) all_stars_descr = do_calibration.get_star_descriptions() # if SHOW_UPSILON: # big_green = set_custom_label(comparison_ star_descr, 'comp') # small_red = set_custom_label(apass_star_descr, [o.vmag for o in apass_star_descr]) # big_green = set_custom_label(vsx_star_descr, [o.match['catalog_dict']['name'] for o in vsx_star_descr]) # small_red = set_custom_label(hand_candidates_descr, [o.local_id for o in hand_candidates_descr]) # big_green = set_aavso_id_label(vsx_star_descr) # small_red = set_local_id_label(hand_candidates_descr) all_stars_labeled = set_custom_label(all_stars_descr, '') vsx_labeled = set_aavso_id_label(vsx_star_descr) #vsx_labeled = set_custom_label(vsx_star_descr, [o.local_id for o in vsx_star_descr]) # TODO hand labeled stars # hand_candidates_labeled = set_local_id_label(hand_candidates_descr) # default fields empty = [] # field chart with all detections logging.info("Plotting field chart with all detected stars...") big_green = empty small_red = all_stars_labeled fig = plot_it(big_green, small_red, reference_fits_frame, wcs, "All detected stars", PADDING) save(fig, settings.fieldchartsdirs + 'all_detections_for_{}_stars'.format(len(small_red))) # field chart with all vsx stars logging.info("Plotting field chart with all VSX variable stars...") big_green = vsx_labeled small_red = empty fig = plot_it(big_green, small_red, reference_fits_frame, wcs, "All VSX variable stars", PADDING) save(fig, settings.fieldchartsdirs + 'all_vsx_stars_{}'.format(len(big_green))) # field chart with all vsx stars logging.info("Plotting field chart with all VSX variable stars + hand picked vars...") big_green = vsx_labeled # TODO hand labeled stars small_red = [] # hand_candidates_labeled fig = plot_it(big_green, small_red, reference_fits_frame, wcs, "VSX variable stars + detected variables", PADDING) save(fig, settings.fieldchartsdirs + 'all_vsx_stars_{}_hand_picked_{}'.format(len(big_green), len(small_red)))
def find_best_photometry_config(percentage): # get subset of files for photometry trash_and_recreate_dir(settings.testdir) pattern = 'kout*.fts' logging.info( f"Selecting files from {settings.convfitsdir} with pattern {pattern}") chosen_files = file_selector(settings.convfitsdir, pattern, percentage) logging.info( f"Chosen {len(chosen_files)} files per photometry run, files: {chosen_files}" ) filelist = generate_photometry_config_files() perform_photometry(filelist, chosen_files)
def write_lightcurves(star_list_1, comparison_stars_1, aperture, apertureidx, jd, fwhm, star_result_): trash_and_recreate_dir(settings.lightcurvedir) global preamble preamble = init_preamble(aperture, comparison_stars_1) global star_result star_result = star_result_ pool = mp.Pool(init.nr_threads*2, maxtasksperchild=None) func = partial(write_lightcurve, comparison_stars_1=comparison_stars_1, aperture=aperture, apertureidx=apertureidx, jd=jd, fwhm=fwhm) logging.debug("Writing star lightcurve txt files for", len(star_list_1), "stars into", settings.lightcurvedir) for _ in tqdm(pool.imap_unordered(func, star_list_1), total=len(star_list_1), desc='Writing lightcurve'): pass
def do_world_pos(wcs, star_list, reference_frame_index): trash_and_recreate_dir(settings.worldposdir) logging.info(f"index {reference_frame_index}") pool = mp.Pool(init.nr_threads, maxtasksperchild=100) func = partial(world_pos, wcs=wcs, reference_frame_index=reference_frame_index) logging.info( f"Writing world positions for {len(star_list)} stars into {settings.posdir}" ) for _ in tqdm.tqdm(pool.imap_unordered(func, star_list), total=len(star_list)): pass
def do_write_pos(star_list, aperture, matched_reference_frame, is_resume): if not is_resume: trash_and_recreate_dir(settings.posdir) else: star_list = reduce_star_list(star_list, settings.posdir) pool = mp.Pool(init.nr_threads, maxtasksperchild=100) func = partial(write_pos, matched_reference_frame=matched_reference_frame, aperture=aperture) logging.info( f"Writing star positions for {len(star_list)} stars into {settings.posdir}" ) logging.info(dir(init)) logging.info(dir(settings)) for _ in tqdm.tqdm(pool.imap_unordered(func, star_list, 10), total=len(star_list)): pass
def generate_matching_config_files(): logging.info("Generating matching config files...") trash_and_recreate_dir(settings.testdir + 'matching') result = [] counter = 0 for max_stars in np.arange(10, 60, 15): for vertices in range(3, 10, 2): for clip_thresh in range(100, 5000, 1000): for sp_fields in range(0, 3, 1): for sp_maxoffset in range(1, 3000, 1000): counter += 1 filename = f'{settings.testdir}matching/match{counter}.conf' logging.info(f"Writing to filename {filename}") write_matching_config(filename, max_stars, vertices, clip_thresh, sp_fields, sp_maxoffset) result.append(filename) logging.info(f"{len(result)} matching config files generated.") return result
def run(star_descriptions, comparison_stars, do_charts, do_phase): CHUNK = 10 set_seaborn_style() pool = mp.Pool(init.nr_threads) if do_charts: trash_and_recreate_dir(settings.chartsdir) if do_phase: trash_and_recreate_dir(settings.phasedir) func = partial(read_lightcurves, comparison_stars=comparison_stars, do_charts=do_charts, do_phase=do_phase) for _ in tqdm.tqdm(pool.imap_unordered(func, star_descriptions, chunksize=CHUNK), total=len(star_descriptions), desc='Writing light curve charts/phase diagrams'): pass
def inspect(vastdir, resultdir, fitsdir, apikey, stars): """generate image+txt file to inspect a certain star on wrong ucac/localid nrs """ reading.trash_and_recreate_dir(Path(resultdir) / "inspect") ref_jd, _, _, reference_frame = reading.extract_reference_frame(vastdir) _, shapex, shapey = reading.get_fits_data(Path(fitsdir, Path(reference_frame).name)) refframes: List[RefFrame] = [ RefFrame( ref_jd, Path(vastdir) / "new-image.fits", Path(fitsdir, Path(reference_frame).name), ) ] # construct star descriptions sds = utils_sd.construct_star_descriptions(vastdir, None) star_catalog = do_calibration.create_star_descriptions_catalog(sds) if args.radecs: main_vast.read_and_tag_radec(args.radecs, sds) if args.localids: stardict = main_vast.get_localid_to_sd_dict(sds) main_vast.read_and_tag_localid(args.localids, stardict) if args.stars: stars = sorted(list(map(lambda x: int(x), stars))) else: stars = sorted([x.local_id for x in sds if x.get_metadata("SELECTEDTAG")]) for starid in stars: process( vastdir, resultdir, fitsdir, apikey, shapex, shapey, starid, ref_jd, reference_frame, sds, star_catalog, refframes, )
def write_photometry(config_file=settings.basedir + 'muniphot.conf', files=None, outputfile_prefix='phot', outputdir=settings.photometrydir): trash_and_recreate_dir(settings.photometrydir) if files is None: files = glob.glob(settings.convfitsdir + "*.fts") logging.info( f"Writing photometry, config_file:{config_file}, outputdir: {outputdir}, outputfile_prefix: {outputfile_prefix}..." ) config_file_param = f'-p {config_file}' if config_file is not '' else '' pool = mp.Pool(init.nr_threads * 2, maxtasksperchild=100) func = partial(command_caller, config_file_param=config_file_param, outputdir=outputdir, outputfile_prefix=outputfile_prefix) logging.info( f"Writing star photometry for {len(files)} stars into {outputdir}") logging.info(files) for _ in tqdm.tqdm(pool.imap_unordered(func, files, 5), total=len(files)): pass
def run( star_descriptions, comp_stars: ComparisonStars, basedir: str, resultdir: str, phasepart: str, chartspart: str, aavso_part: str, do_light=False, do_light_raw=False, do_phase=True, do_aavso=False, aavsolimit=None, nr_threads=cpu_count(), jdfilter=None, desc="Writing light curve charts/phase diagrams", ): chunk: int = 1 # max(1, len(star_descriptions) // nr_threads*10) set_font_size() pool = mp.Pool(nr_threads, maxtasksperchild=10) phasedir = Path(resultdir, phasepart) chartsdir = Path(resultdir, chartspart) aavsodir = Path(resultdir, aavso_part) logging.debug( f"Using {nr_threads} threads for lightcurve, phase plotting and aavso reporting." ) if do_phase: trash_and_recreate_dir(phasedir) trash_and_recreate_dir(Path(phasedir, Path("txt"))) if do_light or do_light_raw: trash_and_recreate_dir(chartsdir) if do_aavso: trash_and_recreate_dir(aavsodir) with Manager() as manager: comp_stars_proxy = manager.Value("comp_stars", comp_stars) star_result_dict = manager.dict({}) func = partial( read_vast_lightcurves, basedir=basedir, compstarproxy=comp_stars_proxy, star_result_dict=star_result_dict, do_light=do_light, do_light_raw=do_light_raw, do_phase=do_phase, do_aavso=do_aavso, aavso_limit=aavsolimit, phasedir=phasedir, chartsdir=chartsdir, aavsodir=aavsodir, jdfilter=jdfilter, ) with tqdm.tqdm(total=len(star_descriptions), desc=desc, unit="stars") as pbar: for _ in pool.imap_unordered(func, star_descriptions, chunksize=chunk): pbar.update(1) pass pool.close() pool.join() stardict = main_vast.get_localid_to_sd_dict(star_descriptions) for key, value in star_result_dict.items(): star_result = stardict[key].result for key2, value2 in value.items(): if key2 not in star_result: star_result[key2] = value2
def write_convert_fits(): logging.info("Convert fits files to fts") trash_and_recreate_dir(settings.convfitsdir) os.system('konve ' + settings.fitsdir + '*.fit -o ' + settings.convfitsdir + 'kout??????.fts')
def run_do_rest(do_convert_fits, do_photometry, do_match, do_compstars_flag, do_aperture_search, do_lightcurve_flag, do_pos, do_ml, do_lightcurve_plot, do_phase_diagram, do_field_charting, do_reporting, args): if do_convert_fits: logging.info("Converting fits...") write_convert_fits() # either read the previous reference frame or calculate a new one _, _, reference_frame_index = do_calibration.get_reference_frame( 100, do_calibration.select_reference_frame_jpeg) logging.info(f"reference header is {settings.reference_header}") # get wcs model from the reference header. Used in writing world positions and field charts wcs = do_calibration.get_wcs(settings.reference_header) apertures = None aperture = None apertureidx = None if do_photometry: logging.info( f"Writing photometry with config file {settings.conf_phot}...") write_photometry(config_file=settings.conf_phot) if do_match: logging.info("Performing matching...") pool = mp.Pool(init.nr_threads, maxtasksperchild=100) ref_frame = do_calibration.find_reference_photometry( reference_frame_index) file_list = utils.get_files_in_dir(settings.photometrydir) file_list.sort() func = partial(write_match, base_photometry_file=ref_frame) logging.info( f"Writing matches for {len(file_list)} stars with reference frame {ref_frame}" ) trash_and_recreate_dir(settings.matchedphotometrydir) for _ in tqdm.tqdm(pool.imap_unordered(func, file_list, 10), total=len(file_list)): pass if do_aperture_search: logging.info("Searching best aperture...") # getting aperture stddevs = None counts = None # stddevs, _, apertures, apertureidx, _, _, counts = do_aperture.main(the_dir=settings.matchedphotometrydir, percentage=init.aperture_find_percentage) apertures = [x for x in do_aperture.get_apertures()] apertureidx = np.abs(np.array(apertures) - init.aperture).argmin() aperture = apertures[apertureidx] # saving all calculated data np.savetxt(settings.basedir + "apertures.txt", apertures, fmt='%.2f', delimiter=';') np.savetxt(settings.basedir + "apertureidx_best.txt", [apertureidx], fmt='%d') logging.debug("Done writing aperture search results") else: logging.info("Loading best aperture...") apertures, apertureidx, aperture = reading.read_aperture() logging.info(f"aperture: {aperture}, apertures:{apertures}") if do_pos: logging.info( "Writing positions of all stars on the reference image...") reference_matched = do_calibration.find_reference_matched( reference_frame_index) logging.info(f"reference match is {reference_matched}") do_write_pos(init.star_list, aperture, reference_matched, is_resume=False) do_world_pos(wcs, init.star_list, reference_frame_index) if do_ml: logging.info("Doing ML detection of variable stars...") import do_upsilon # do it here because it takes some time at startup do_upsilon.run(init.star_list) if (do_lightcurve_flag or do_field_charting): logging.info("Loading photometry...") jd, fwhm, nrstars, star_result = read_photometry.read_photometry( init.star_list, apertureidx) # costruction of the star descriptions list comparison_stars_1, comparison_stars_1_desc, star_descriptions = construct_star_descriptions( args, do_compstars_flag) if do_lightcurve_flag: logging.info(f"Writing lightcurves...") chosen_stars = [x.local_id for x in star_descriptions] do_lightcurve.write_lightcurves(chosen_stars, comparison_stars_1, aperture, int(apertureidx), jd, fwhm, star_result) if do_lightcurve_plot or do_phase_diagram: logging.info("starting charting / phase diagrams...") do_charts.run(star_descriptions, comparison_stars_1_desc, do_lightcurve_plot, do_phase_diagram) if do_field_charting: logging.info("Starting field chart plotting...") vsx_stars = list(filter(vsx_filter, star_descriptions)) do_charts_field.run_standard_field_charts(vsx_stars, wcs) # do_charts_stats.main(fwhm) # import code # code.InteractiveConsole(locals=dict(globals(), **locals())).interact() if do_reporting: # star_descriptions_ucac4 = do_calibration.add_ucac4_to_star_descriptions(star_descriptions) vsx_stars = list(filter(vsx_filter, star_descriptions)) logging.info(f"AAVSO Reporting with: {len(vsx_stars)} stars") trash_and_recreate_dir(settings.aavsoreportsdir) for star in vsx_stars: do_aavso_report.report(settings.aavsoreportsdir, star, comparison_stars_1_desc[0])
def run_do_rest(args): thread_count = args.threads vastdir = utils.add_trailing_slash(args.datadir) resultdir = clean_and_create_resultdir(args.resultdir, vastdir) do_light = args.light do_phase = args.phase do_aavso = args.aavso logging.info( f"Dir with VaST files: '{vastdir}'\nResults dir: '{resultdir}'") # get wcs model from the reference header. Used in writing world positions and field charts (can fail) wcs_file, wcs = reading.read_wcs_file(vastdir) ref_jd, _, _, reference_frame = reading.extract_reference_frame(vastdir) _, _, _, first_frame = reading.extract_first_frame(vastdir) reference_frame_path = Path(reference_frame) reference_frame_filename = reference_frame_path.name wcs_file, wcs = perform_astrometry_net(args, vastdir, wcs_file, wcs, reference_frame_filename) logging.info(f"The reference frame is '{reference_frame}' at JD: {ref_jd}") logging.info(f"The first frame is '{first_frame}'") logging.info(f"Reference header is '{wcs_file}'") check_that_reference_image_not_within_jdfilter(ref_jd, args.jdfilter, args.jdrefignore) star_descriptions = construct_star_descriptions(vastdir, resultdir, wcs, args) stardict = get_localid_to_sd_dict(star_descriptions) logging.debug( f"First (max) 10 star descriptions: " f"{star_descriptions[:10] if (len(star_descriptions) >= 10) else star_descriptions}" ) write_augmented_autocandidates(vastdir, resultdir, stardict) write_augmented_all_stars(vastdir, resultdir, stardict) candidate_stars = utils.get_stars_with_metadata(star_descriptions, "CANDIDATE", exclude=["VSX"]) if args.selectcandidates: tag_candidates_as_selected(candidate_stars) logging.info(f"There are {len(candidate_stars)} candidate stars") vsx_stars = utils.get_stars_with_metadata(star_descriptions, "VSX") logging.info(f"There are {len(vsx_stars)} vsx stars") if args.allstars: tag_all_stars_as_selected(star_descriptions) selected_stars = utils.get_stars_with_metadata(star_descriptions, "SELECTEDTAG") logging.info(f"There are {len(selected_stars)} selected stars") compstar_needing_stars = utils.concat_sd_lists(selected_stars, vsx_stars, candidate_stars) comp_stars = set_comp_stars_and_ucac4(star_descriptions, selected_stars, args.checkstarfile, vastdir, stardict, ref_jd) # Set comp stars for all interesting stars (stars which are interesting enough to measure) logging.info("Setting per star comparison stars...") if args.checkstarfile: utils.add_metadata(star_descriptions, CompStarData(compstar_ids=comp_stars.ids)) else: do_compstars.add_closest_compstars(compstar_needing_stars, comp_stars, 10) logging.info( f"Using {thread_count} threads for phase plots, lightcurves, ...") if args.allstars: do_charts_vast.run( star_descriptions, comp_stars, vastdir, resultdir, "phase_all/", "light_all/", "aavso_all/", do_phase=do_phase, do_light=do_light, do_light_raw=do_light, do_aavso=do_aavso, nr_threads=thread_count, jdfilter=args.jdfilter, desc="Phase/light/aavso of ALL stars", ) else: if args.vsx: logging.info(f"Plotting {len(vsx_stars)} vsx stars...") do_charts_vast.run( vsx_stars, comp_stars, vastdir, resultdir, "phase_vsx/", "light_vsx/", "aavso_vsx/", do_phase=do_phase, do_light=do_light, do_light_raw=do_light, do_aavso=do_aavso, nr_threads=thread_count, jdfilter=args.jdfilter, desc="Phase/light/aavso of VSX stars", ) if args.radeccatalog or args.localidcatalog: do_charts_vast.run( selected_stars, comp_stars, vastdir, resultdir, "phase_selected/", "light_selected/", "aavso_selected", do_phase=do_phase, do_light=do_light, do_light_raw=do_light, do_aavso=do_aavso, nr_threads=thread_count, jdfilter=args.jdfilter, desc="Phase/light/aavso of selected stars", ) if args.candidates: logging.info(f"Plotting {len(candidate_stars)} candidates...") do_charts_vast.run( candidate_stars, comp_stars, vastdir, resultdir, "phase_candidates/", "light_candidates/", "aavso_candidates/", do_phase=do_phase, do_light=do_light, do_light_raw=do_light, do_aavso=do_aavso, nr_threads=thread_count, jdfilter=args.jdfilter, desc="Phase/light/aavso of candidates", ) # starfiledata is filled in during the phase plotting, so should come after it. Without phase it will be incomplete ids = [x.local_id for x in selected_stars] logging.info( f"Writing selected files with {len(selected_stars)} selected stars: {ids}" ) write_selected_files(resultdir, vastdir, selected_stars) # only create fieldcharts dir if we use it fieldchartsdir = resultdir + "fieldcharts/" if args.field or args.stats: trash_and_recreate_dir(fieldchartsdir) if args.field: do_charts_field.run_standard_field_charts(star_descriptions, wcs, fieldchartsdir, wcs_file, comp_stars) if args.stats: do_charts_stats.plot_comparison_stars(fieldchartsdir, selected_stars, stardict, args.jdfilter) do_charts_stats.plot_aperture_vs_jd(fieldchartsdir, vastdir, args.jdfilter) do_charts_stats.plot_aperture_vs_airmass(fieldchartsdir, vastdir, wcs, args.jdfilter) do_charts_stats.plot_merr_vs_jd(fieldchartsdir, selected_stars, args.jdfilter) if args.site: ids = [x.local_id for x in selected_stars] logging.info( f"Creating HTML site with {len(selected_stars)} selected stars: {ids}" ) hugo_site.run(args.site, selected_stars, len(vsx_stars), reference_frame_path, resultdir, args.explore)
def run_standard_field_charts( star_descriptions: StarDescriptionList, wcs, fieldchartsdirs, reference_fits_frame, comp_stars: ComparisonStars, ): trash_and_recreate_dir(fieldchartsdirs) # setting the font size for titles/axes plt.rcParams.update({"axes.titlesize": "large", "axes.labelsize": "large"}) fits_data, _, _ = reading.get_fits_data(reference_fits_frame) fits_data_blank, _, _ = reading.get_fits_data(reference_fits_frame, blank_data=True) SHOW_UPSILON = False # if SHOW_UPSILON: # candidates = do_calibration.get_candidates(0.5) # TODO hand labeled stars # hand_candidates_descr = do_calibration.get_star_descriptions(init.wwcra_certain_candidates) all_stars_descr = star_descriptions # if SHOW_UPSILON: # big_green = set_custom_label(comparison_ star_descr, 'comp') # small_red = set_custom_label(apass_star_descr, [o.vmag for o in apass_star_descr]) # big_green = set_custom_label(vsx_star_descr, [o.match['catalog_dict']['name'] for o in vsx_star_descr]) # small_red = set_custom_label(hand_candidates_descr, [o.local_id for o in hand_candidates_descr]) # big_green = set_aavso_id_label(vsx_star_descr) # small_red = set_local_id_label(hand_candidates_descr) # all stars get a blank label all_stars_no_label = set_custom_label(all_stars_descr, "") # field chart with all detections logging.info("Plotting field chart with all detected stars...") fig = plot_it( [all_stars_no_label], [4.0], [False], fits_data, wcs, "All detected stars", PADDING, annotate=False, ) save( fig, fieldchartsdirs + "all_detections_{}_stars".format(len(all_stars_no_label)) ) # vsx stars get their aavso id label vsx_descr = utils.get_stars_with_metadata(star_descriptions, "VSX") vsx_labeled = set_aavso_id_label(vsx_descr) # field chart with all vsx stars logging.info("Plotting field chart with all VSX variable stars...") fig = plot_it( [vsx_labeled], [10.0], [False], fits_data, wcs, "All VSX stars", PADDING ) save(fig, fieldchartsdirs + "vsx_stars_{}".format(len(vsx_labeled))) # field chart with all vsx stars without the background logging.info( "Plotting field chart with all VSX variable stars without reference field..." ) fig = plot_it( [vsx_labeled], [10.0], [False], fits_data_blank, wcs, "VSX without background", PADDING, ) save(fig, fieldchartsdirs + "vsx_stars_no_ref_{}".format(len(vsx_labeled))) # field chart with only the background logging.info("Plotting field chart with only the reference field...") fig, _ = get_plot_with_background_data(fits_data, 0, "Reference frame") save(fig, fieldchartsdirs + "only_ref") # candidate stars get their local id label candidate_descr = utils.get_stars_with_metadata( star_descriptions, "CANDIDATE", exclude=["VSX"] ) candidate_labeled = set_local_id_label(candidate_descr) # localid/radec inputfile stars get their local id label selected_desc = utils.get_stars_with_metadata(star_descriptions, "SITE") selected_no_vsx_descr = utils.get_stars_with_metadata( star_descriptions, "SITE", exclude=["VSX"] ) selected_no_vsx_labeled = set_custom_label( selected_no_vsx_descr, [x.get_metadata("SITE").our_name for x in selected_no_vsx_descr], ) selected_count = len(selected_no_vsx_labeled) # field chart with all vsx stars + candidates + radeccatalog logging.info("Plotting field chart with all VSX variable stars + candidate vars...") fig = plot_it( [vsx_labeled, candidate_labeled], [10.0, 5.0], [False, True], fits_data, wcs, "VSX stars + candidate stars", PADDING, ) save( fig, fieldchartsdirs + f"vsx_{len(vsx_labeled)}_and_candidates_{len(candidate_labeled)}", ) # field chart with all vsx stars + localid/radec inputfile logging.info( f"Plotting field chart with all VSX variable stars + {selected_count} selected vars..." ) fig = plot_it( [vsx_labeled, selected_no_vsx_labeled], [10.0, 5.0], [False, True], fits_data, wcs, "VSX stars + selected stars", PADDING, ) save( fig, fieldchartsdirs + "vsx_{}_and_selected_{}".format(len(vsx_labeled), selected_count), ) # compstars get their vmag as label # comp_stars_descr = comp_stars.star_descriptions # comp_stars_labeled = set_custom_label(comp_stars_descr, [x.vmag for x in comp_stars_descr]) logging.info( f"Plotting field chart for each of the {selected_count} selected stars" ) # Plotting finder charts for the site # field charts for each individually selected starfile star for star in tqdm.tqdm(selected_desc, desc="Field chart for each star"): filtered_compstars, check_star = do_compstars.filter_comparison_stars( star, comp_stars ) filtered_compstars_sds = filtered_compstars.star_descriptions check_star_sd = check_star.star_descriptions compstars_labeled = set_custom_label( filtered_compstars_sds, [x.get_metadata("UCAC4").vmag for x in filtered_compstars_sds], ) checkstar_labeled = set_custom_label( check_star_sd, f"Kmag={check_star_sd[0].get_metadata('UCAC4').vmag}" ) starui: utils.StarUI = utils.get_star_or_catalog_name(star, suffix="") fig = plot_it( [[star], vsx_labeled, compstars_labeled, checkstar_labeled], [7.0, 5.0, 3.0, 4.0], [True, False, True, False], fits_data, wcs, f"VSX stars + comp stars + {starui.catalog_name} (star {star.local_id})", PADDING, ) save(fig, f"{fieldchartsdirs}vsx_and_star_{starui.filename_no_ext}") gc.collect()