Ejemplo n.º 1
0
import sys
import numpy as np
import datetime
import astropy.io.fits as fits
import astropy.units as u
import astropy.coordinates as coords
from astropy.time import Time
import dateutil.parser
import shutil
import functools
from lemon import methods
import repipy
import tempfile

# Change to the directory where repipy is installed to load pyraf
with methods.tmp_chdir(repipy.__path__[0]):
    from pyraf import iraf
    from iraf import astutil

@contextlib.contextmanager
def tmp_mute():
    """ A context manager to temporarily change the std output. This can be used to mute the output of certain
    extremely verbose programs I know ;).

    """

    std_output = sys.stdout
    try:
        with open(os.devnull, 'w') as fd:
            sys.stdout = fd
            yield
Ejemplo n.º 2
0
#! /usr/bin/env python
# -*- coding: utf-8 -*-

import tempfile
import argparse
import sys
import os


import lemon.methods as methods

# Change to the directory where repipy is installed to load pyraf
with methods.tmp_chdir(os.path.dirname(os.path.abspath(__file__))):
    import pyraf.iraf as iraf
    from iraf import digiphot
    from iraf import daophot


import repipy.astroim as astroim
import repipy.utilities as utils
import warnings

warnings.filterwarnings("ignore")


# fd, coords_file = tempfile.mkstemp(prefix=basename, suffix=".coords")


def apply_phot(args):
    # Temporary file
    with tempfile.NamedTemporaryFile(suffix=".mag.1") as fd: