Example #1
0
def main(full, stars, comparison, calc, calib, phot, plot, detrend, eebls, period, indir, ra, dec, target_file, format, imgreject, bjd, clean, verbose):

    try:
        parentPath = Path(indir)
        if clean:
            cleanup(parentPath)
            logger.info('All temporary files removed')
            return
        if not (ra and dec) and not target_file:
            logger.error("Either RA and Dec or a targetfile must be specified")
            return

        if ra and dec:
            targets = array([(ra,dec,0,0)])
        elif target_file:
            target_file = parentPath / target_file
            targets = get_targets(target_file)

        ts = TimeSeries(indir=parentPath, targets=targets, format=format, verbose=verbose)

        if full or comparison:
            ts.analyse()
        if full or calc:
            ts.find_stable()
        if full or phot:
            ts.photometry(filesave=True)
        if full or plot:
            ts.plot(detrend=detrend, period=period, eebls=eebls, filesave=True)


        sys.stdout.write("✅ AstroSource analysis complete\n")

    except AstrosourceException as e:
        logger.critical(e)
    return
Example #2
0
def main(full, stars, comparison, calc, calib, phot, plot, detrend, eebls, period, indir, ra, dec, target_file, format, imgreject, mincompstars, closerejectd, bjd, clean, verbose, periodlower, periodupper, periodtests, rejectbrighter, rejectdimmer, thresholdcounts, nopanstarrs, nosdss, skipvarsearch, starreject, hicounts, lowcounts):

    try:
        parentPath = Path(indir)
        if clean:
            cleanup(parentPath)
            logger.info('All temporary files removed')
            return
        if not (ra and dec) and not target_file:
            logger.error("Either RA and Dec or a targetfile must be specified")
            return

        if ra and dec:
            targets = array([(ra, dec, 0, 0)])
        elif target_file:
            target_file = parentPath / target_file
            targets = get_targets(target_file)

        ts = TimeSeries(indir=parentPath,
                        targets=targets,
                        format=format,
                        imgreject=imgreject,
                        periodupper=periodupper,
                        periodlower=periodlower,
                        periodtests=periodtests,
                        rejectbrighter=rejectbrighter,
                        rejectdimmer=rejectdimmer,
                        thresholdcounts=thresholdcounts,
                        lowcounts=lowcounts,
                        hicounts=hicounts,
                        starreject=starreject,
                        nopanstarrs=nopanstarrs,
                        nosdss=nosdss,
                        closerejectd=closerejectd,
                        verbose=verbose,
                        mincompstars=mincompstars
                        )

        if full or comparison:
            ts.analyse()
        if (full or calc) and not skipvarsearch:
            ts.find_variables()
        if full or phot:
            ts.photometry(filesave=True)
        if full or plot:
            ts.plot(detrend=detrend, period=period, eebls=eebls, filesave=True)

        sys.stdout.write("✅ AstroSource analysis complete\n")

    except AstrosourceException as e:
        logger.critical(e)
    return
Example #3
0
def main(full, stars, comparison, calc, calib, phot, plot, detrend, eebls,
         indir, ra, dec, target_file, format, clean):
    try:
        parentPath = Path(indir)
        if clean:
            cleanup(parentPath)
            logger.info('All temporary files removed')
            return
        if not (ra and dec) and not target_file:
            logger.error("Either RA and Dec or a targetfile must be specified")
            return

        paths = folder_setup(parentPath)
        filelist, filtercode = gather_files(paths, filetype=format)

        if ra and dec:
            targets = array([(ra, dec, 0, 0)])
        elif target_file:
            target_file = parentPath / target_file
            targets = get_targets(target_file)

        # sys.tracebacklimit = 0

        if full or stars:
            usedimages = find_stars(targets, paths, filelist)
        if full or comparison and not calib:
            find_comparisons(parentPath)
        if full or comparison and calib:
            # Check that it is a filter that can actually be calibrated - in the future I am considering calibrating w against V to give a 'rough V' calibration, but not for now.
            if filtercode == 'B' or filterCode == 'V' or filtercode == 'up' or filtercode == 'gp' or filtercode == 'rp' or filtercode == 'ip' or filtercode == 'zs':
                find_comparisons_calibrated(filtercode, paths)
            else:
                find_comparisons(parentPath)
        if full or calc:
            calculate_curves(targets, parentPath=parentPath)
        if full or phot:
            photometric_calculations(targets, paths=paths)
        if full or plot and not detrend and not calib:
            make_plots(filterCode=filtercode, paths=paths)
        if detrend:
            detrend_data(paths, filterCode=filtercode)
        if eebls:
            plot_bls(paths=paths)
        if calib:
            plot_with_period(paths, filterCode=filtercode)
        logger.info("Completed analysis")

    except AstrosourceException as e:
        logger.critical(e)
Example #4
0
 def clean(self):
     cleanup(parentPath=self.paths['parent'])
Example #5
0
 def clean(self):
     cleanup(self.paths['parent'])