def __init__(self, targets, indir, **kwargs):
     self.targets = targets
     self.indir = Path(indir)
     filelist = kwargs.get('filelist', None)
     self.format = kwargs.get('format', 'fz')
     self.imgreject = kwargs.get('imgreject', 0.05)
     self.periodupper = kwargs.get('periodupper', -99.9)
     self.periodlower = kwargs.get('periodlower', -99.9)
     self.periodtests = kwargs.get('periodtests', -99)
     self.rejectbrighter = kwargs.get('rejectbrighter', 99)
     self.rejectdimmer = kwargs.get('rejectdimmer', 99)
     self.thresholdcounts = kwargs.get('thresholdcounts', 1000000)
     self.hicounts = kwargs.get('hicounts', 1500000)
     self.lowcounts = kwargs.get('lowcounts', 1000)
     self.starreject = kwargs.get('starreject', 0.3)
     self.nopanstarrs = kwargs.get('nopanstarrs', False)
     self.nosdss = kwargs.get('nosdss', False)
     self.closerejectd = kwargs.get('closerejectd', 5.0)
     self.skipvarsearch = kwargs.get('skipvarsearch', False)
     self.mincompstars = kwargs.get('mincompstars', 0.1)
     verbose = kwargs.get('verbose', False)
     bjd = kwargs.get('bjd', False)
     self.paths = folder_setup(self.indir)
     logger = setup_logger('astrosource', verbose)
     self.files, self.filtercode = gather_files(self.paths,
                                                filelist=filelist,
                                                filetype=self.format,
                                                bjd=bjd)
示例#2
0
def test_gather_files():

    phot_files, filtercode = gather_files(TEST_PATHS, filetype="fits")
    test_files = {
        'XOd2_ip_57757d0532642000_2017d01d04T01d16d43d571_1a089113_22d284_kb29.npy':
        'photometry_test2.fits',
        'XOd2_ip_57757d0522793000_2017d01d04T01d15d18d519_1a0899013_22d293_kb29.npy':
        'photometry_test.fits'
    }
    assert phot_files == test_files
示例#3
0
 def __init__(self, targets, indir, **kwargs):
     self.targets = targets
     self.indir = Path(indir)
     filelist=kwargs.get('filelist', None)
     self.format = kwargs.get('format','fz')
     self.imgreject = kwargs.get('imgreject',0.0)
     verbose = kwargs.get('verbose', False)
     bjd = kwargs.get('bjd', False)
     self.paths = folder_setup(self.indir)
     logger = setup_logger('astrosource', verbose)
     self.files, self.filtercode = gather_files(self.paths, filelist=filelist, filetype=self.format, bjd=bjd)
示例#4
0
def test_find_stars():
    targets = numpy.array([[117.0269708, 50.2258111, 0,0]])
    phot_files, filtercode = gather_files(TEST_PATHS, filetype="fits")
    usedImages = find_stars(targets, TEST_PATHS, phot_files)
    images_list = [str(u) for u in usedImages]
    # Check the right files are saved
    test_list = (TEST_PATHS['parent'] / 'usedImages_test.txt').read_text().strip().split('\n')
    assert images_list.sort() == test_list.sort()
    # Clean up
    (TEST_PATHS['parent'] / 'usedImages.txt').unlink()
    test_files = ['XOd2_ip_57757d0522793000_2017d01d04_1a0899013_22d293_kb29.npy',
                  'XOd2_ip_57757d0532642000_2017d01d04_1a089113_22d284_kb29.npy',
                  'screenedComps.csv']
示例#5
0
def test_gather_files():

    phot_files, filtercode = gather_files(TEST_PATHS, filetype="fits")
    test_files = [
        TEST_PATHS['parent'] /
        'XOd2_ip_22d293_2017d01d04_1a0899013_57757d0522793000_kb29.csv',
        TEST_PATHS['parent'] /
        'XOd2_ip_22d284_2017d01d04_1a089113_57757d0532642000_kb29.csv'
    ]
    assert phot_files.sort() == test_files.sort()
    # Clean up
    for tf in test_files:
        os.remove(tf)
示例#6
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)
示例#7
0
def test_find_stars():
    target = [[117.0269708, 50.2258111, 0, 0]]
    phot_files, filtercode = gather_files(TEST_PATHS, filetype="fits")
    usedImages = find_stars(target, TEST_PATHS, phot_files)
    images_list = [str(u) for u in usedImages]
    # Check the targets are in targetstars.csv
    test_targets = (TEST_PATHS['parent'] /
                    'targetstars.csv').read_text().strip().split(',')
    assert test_targets == [
        '117.02697080', '50.22581110', '0.00000000', '0.00000000'
    ]
    # Check the right files are saved
    test_list = (TEST_PATHS['parent'] /
                 'usedImages_test.txt').read_text().strip().split('\n')
    assert images_list.sort() == test_list.sort()
    # Clean up
    (TEST_PATHS['parent'] / 'usedImages.txt').unlink()
    test_files = [
        'XOd2_ip_22d293_2017d01d04_1a0899013_57757d0522793000_kb29.csv',
        'XOd2_ip_22d284_2017d01d04_1a089113_57757d0532642000_kb29.csv',
        'screenedComps.csv', 'targetstars.csv'
    ]
    for tf in test_files:
        (TEST_PATHS['parent'] / tf).unlink()
示例#8
0
def test_gather_files():

    phot_files, filtercode = gather_files(TEST_PATHS, filetype="fits")
    test_files = ['XOd2_ip_57757d0532642000_2017d01d04T01d16d43d571_1a089113_22d284_kb29.npy', 'XOd2_ip_57757d0522793000_2017d01d04T01d15d18d519_1a0899013_22d293_kb29.npy']
    assert phot_files.sort() == test_files.sort()