Skip to content

Commit

Permalink
Fix broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiopasra committed Jan 10, 2019
1 parent d21ca68 commit 255a9d8
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 14 deletions.
9 changes: 6 additions & 3 deletions megaradrp/recipes/calibration/tests/test_bpm.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2015-2017 Universidad Complutense de Madrid
# Copyright 2015-2019 Universidad Complutense de Madrid
#
# This file is part of Megara DRP
#
Expand All @@ -15,12 +15,12 @@
import numpy as np

from numina.core import DataFrame, ObservationResult
from numina.core.insconf import instrument_loader

from megaradrp.recipes.calibration.bpm import BadPixelsMaskRecipe
from megaradrp.recipes.calibration.tests.test_bpm_common import generate_bias
from megaradrp.simulation.detector import ReadParams, MegaraDetectorSat
from megaradrp.simulation.actions import simulate_flat
from megaradrp.instrument.loader import build_instrument_config, Loader


# @pytest.mark.remote
Expand Down Expand Up @@ -76,7 +76,10 @@ def test_bpm():
ob = ObservationResult()
ob.instrument = 'MEGARA'
ob.mode = 'MegaraBiasImage'
ob.configuration = build_instrument_config(config_uuid, loader=Loader())
modpath = 'megaradrp.instrument.configs'
fname = 'instrument-{}.json'.format(config_uuid)

ob.configuration = instrument_loader(modpath, fname)

names = []
for aux in range(number * 2):
Expand Down
15 changes: 11 additions & 4 deletions megaradrp/recipes/calibration/tests/test_bpm_common.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2015-2017 Universidad Complutense de Madrid
# Copyright 2015-2019 Universidad Complutense de Madrid
#
# This file is part of Megara DRP
#
Expand All @@ -12,8 +12,8 @@
import astropy.io.fits as fits
import numpy as np
from numina.core import DataFrame, ObservationResult
from numina.core.insconf import instrument_loader

from megaradrp.instrument.loader import build_instrument_config, Loader

def generate_bias(detector, number, temporary_path):
from megaradrp.simulation.actions import simulate_bias
Expand All @@ -33,7 +33,11 @@ def generate_bias(detector, number, temporary_path):
ob = ObservationResult()
ob.instrument = 'MEGARA'
ob.mode = 'bias_image'
ob.configuration = build_instrument_config(config_uuid, loader=Loader())

modpath = 'megaradrp.instrument.configs'
fname = 'instrument-{}.json'.format(config_uuid)

ob.configuration = instrument_loader(modpath, fname)
ob.frames = [DataFrame(filename=f) for f in fs]

recipe = BiasRecipe()
Expand Down Expand Up @@ -86,7 +90,10 @@ def crear_archivos(temporary_path, number=5):
ob = ObservationResult()
ob.instrument = 'MEGARA'
ob.mode = 'bias_image'
ob.configuration = build_instrument_config(config_uuid, loader=Loader())
modpath = 'megaradrp.instrument.configs'
fname = 'instrument-{}.json'.format(config_uuid)

ob.configuration = instrument_loader(modpath, fname)

names = []
for aux in range(number):
Expand Down
13 changes: 9 additions & 4 deletions megaradrp/recipes/calibration/tests/test_bpm_corrector.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2015-2017 Universidad Complutense de Madrid
# Copyright 2015-2019 Universidad Complutense de Madrid
#
# This file is part of Megara DRP
#
Expand All @@ -12,7 +12,7 @@
from numina.core import DataFrame, ObservationResult
import astropy.io.fits as fits
from numina.core.requirements import ObservationResultRequirement

from numina.core.insconf import instrument_loader

from megaradrp.core.recipe import MegaraBaseRecipe
from megaradrp.requirements import MasterBiasRequirement, MasterBPMRequirement
Expand All @@ -22,7 +22,7 @@
from megaradrp.processing.combine import basic_processing_with_combination

from megaradrp.recipes.calibration.tests.test_bpm_common import crear_archivos
from megaradrp.instrument.loader import build_instrument_config, Loader



class DerivedRecipe(MegaraBaseRecipe):
Expand Down Expand Up @@ -61,13 +61,18 @@ def test_bpm_corrector():
import shutil
from tempfile import mkdtemp

config_uuid = '4fd05b24-2ed9-457b-b563-a3c618bb1d4c'

directorio = mkdtemp()
names = crear_archivos(directorio, number=4)

ob = ObservationResult()
ob.instrument = 'MEGARA'
ob.mode = 'MegaraBiasImage'
ob.configuration = build_instrument_config('4fd05b24-2ed9-457b-b563-a3c618bb1d4c', loader=Loader())
modpath = 'megaradrp.instrument.configs'
fname = 'instrument-{}.json'.format(config_uuid)

ob.configuration = instrument_loader(modpath, fname)
ob.frames = [DataFrame(filename=open(nombre).name) for nombre in names]

recipe = DerivedRecipe(directorio)
Expand Down
9 changes: 6 additions & 3 deletions megaradrp/recipes/calibration/tests/test_dark.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2015-2017 Universidad Complutense de Madrid
# Copyright 2015-2019 Universidad Complutense de Madrid
#
# This file is part of Megara DRP
#
Expand All @@ -13,12 +13,12 @@
import astropy.io.fits as fits
import numpy
from numina.core import DataFrame, ObservationResult
from numina.core.insconf import instrument_loader

from megaradrp.recipes.calibration.dark import DarkRecipe
from megaradrp.simulation.factory import MegaraImageFactory
from megaradrp.simulation.detector import ReadParams, MegaraDetectorSat
from megaradrp.simulation.actions import simulate_dark_fits
from megaradrp.instrument.loader import build_instrument_config, Loader


def test_dark():
Expand Down Expand Up @@ -67,7 +67,10 @@ def test_dark():
ob = ObservationResult()
ob.instrument = 'MEGARA'
ob.mode = 'MegaraDarkImage'
ob.configuration = build_instrument_config(config_uuid, loader=Loader())
modpath = 'megaradrp.instrument.configs'
fname = 'instrument-{}.json'.format(config_uuid)

ob.configuration = instrument_loader(modpath, fname)

names = []
for aux in range(number):
Expand Down

0 comments on commit 255a9d8

Please sign in to comment.