Commit dcb1ef67 authored by Johann Cohen-Tanugi's avatar Johann Cohen-Tanugi
Browse files

fix merging

parents 2631e533 8298c03b
*~
doc/latex
doc/html
build
source/*.o
source/mag_gal
source/filter
......@@ -11,3 +15,4 @@ test/photoz/cpp/*.out
test/photoz/fortran
test/WORK/*
test/*.out
*__pycache__*
[submodule "extern/pybind11"]
path = extern/pybind11
url = git@github.com:pybind/pybind11
branch = stable
Cmake_minimum_required(VERSION 3.10)
project(lephare VERSION 1.0)
# specify the C++ standard
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# Set source directory
set(SOURCE_DIR "./source")
# Tell CMake that headers are also in SOURCE_DIR
include_directories(${SOURCE_DIR})
#provide exhaustive list of source files, as recommended by
#CMake developers
set(SOURCES
"${SOURCE_DIR}/cosmology.cpp"
"${SOURCE_DIR}/ext.cpp"
"${SOURCE_DIR}/flt.cpp"
"${SOURCE_DIR}/globals.cpp"
"${SOURCE_DIR}/keyword.cpp"
"${SOURCE_DIR}/mag.cpp"
"${SOURCE_DIR}/onesource.cpp"
"${SOURCE_DIR}/oneElLambda.cpp"
"${SOURCE_DIR}/opa.cpp"
"${SOURCE_DIR}/option_demultipliate.cpp"
"${SOURCE_DIR}/PDF.cpp"
"${SOURCE_DIR}/read_LFdata.cpp"
"${SOURCE_DIR}/photoz_lib.cpp"
"${SOURCE_DIR}/SED.cpp"
"${SOURCE_DIR}/SEDLib.cpp"
"${SOURCE_DIR}/write_output_fit.cpp"
)
add_library(lepharelib STATIC ${SOURCES})
find_package(OpenMP)
if(OpenMP_CXX_FOUND)
target_link_libraries(lepharelib PUBLIC OpenMP::OpenMP_CXX)
endif()
# Build the LePhare executables
add_executable(filter
"${SOURCE_DIR}/filter.cpp"
)
target_link_libraries(filter lepharelib)
add_executable(sedtolib
"${SOURCE_DIR}/sedtolib.cpp"
)
target_link_libraries(sedtolib lepharelib)
add_executable(mag_gal
"${SOURCE_DIR}/mag_gal.cpp"
)
target_link_libraries(mag_gal lepharelib)
add_executable(zphota
"${SOURCE_DIR}/zphota.cpp"
)
target_link_libraries(zphota lepharelib)
# Build the python module
add_subdirectory(extern/pybind11/)
pybind11_add_module(_lephare ${SOURCES} "${SOURCE_DIR}/_bindings.cc")
# target_compile_definitions(_lephare
# PRIVATE VERSION_INFO=${EXAMPLE_VERSION_INFO})
#find_package(OpenMP)
if(OpenMP_CXX_FOUND)
target_link_libraries(_lephare PUBLIC OpenMP::OpenMP_CXX)
endif()
......@@ -111,96 +111,97 @@ All the input ascii files can have comment lines starting with #. A single confi
| ---|:---:|---|
|COSMOLOGY| H0,OmegaM,OmegaL| LCDM relevant cosmological keywords|
|FILTER_FILE| | same as above|
|MAGTYPE| | |
|EXTINC_LAW| | |
|EB_V| | |
|MOD_EXTINC| | |
|ZGRID_TYPE| | |
|Z_STEP| | |
|GAL_LIB_IN| | |
|QSO_LIB_IN| | |
|STAR_LIB_IN| | |
|GAL_LIB_OUT| | |
|QSO_LIB_OUT| | |
|STAR_LIB_OUT| | |
|LIB_ASCII| | |
|EM_LINES| | |
|EM_DISPERSION| | |
|MAGTYPE| AB[def] or VEGA | Magnitude type (AB or VEGA) of the library |
|EXTINC_LAW| calzetti.dat[def] | Extinction laws stored in ext/. Could include several files separated by comma.|
|EB_V| 0[def] | Reddening color excess E(B-V) values to be applied. Values separated by comma.|
|MOD_EXTINC| 0,0[def] | Range of models for which extinction will be
applied. Two values per attenutation curves, separated by comma.|
|ZGRID_TYPE| 0[def] or 1| constant step in redshift if 0; evolving step in redshift as (1+z) if 1. |
|Z_STEP| 0.04,0,6 [def] | dz,zmin,zmax: redshift step (dz), the minimum (zmin) and the maximum redshift (zmax)|
|GAL_LIB_IN| | Input galaxy library (in $ZPHOTWORK/lib_bin/)|
|QSO_LIB_IN| | Input AGN library (in $ZPHOTWORK/lib_bin/)|
|STAR_LIB_IN| | Input stellar library (in $ZPHOTWORK/lib_bin/) |
|GAL_LIB_OUT| | Output galaxy library (in $ZPHOTWORK/lib_mag/)|
|QSO_LIB_OUT| | Output AGN library (in $ZPHOTWORK/lib_mag/)|
|STAR_LIB_OUT| | Output stellar library (in $ZPHOTWORK/lib_mag/)|
|LIB_ASCII| NO[def] or YES | Writing the magnitude library in ASCII file |
|EM_LINES| NO[def] or EMP_UV or EMP_SFR or PHYS | choice between emission line prescription |
|EM_DISPERSION| 1[def] | Dispersion allowed in the emission line flux
factor. Exemple: 0.5,0.75,1,1.5,2 |
### zphota
| Keyword name | values | Comment|
| ---|:---:|---|
|CAT_IN| | photometric catalog input|
|INP_TYPE| | |
|CAT_MAG| | |
|CAT_FMT| | |
|CAT_LINES| | |
|ZPHOTLIB| | |
|PARA_OUT| | |
|CAT_OUT| | |
|CAT_TYPE| | |
|ERR_SCALE| | |
|ERR_FACTOR| | |
|BD_SCALE| | |
|GLB_CONTEXT| | |
|FORB_CONTEXT| | |
|CHI2_RM_BD| | |
|MASS_SCALE| | |
|MAG_ABS| | |
|MAG_ABS_AGN| | |
|MAG_REF| | |
|NZ_PRIOR| | |
|Z_RANGE| | |
|EBV_RANGE| | |
|ZFORM_MIN| | |
|LIR_PRIOR| | |
|LIR_PRIOR_NEW| | |
|ZFIX| | |
|MULTIPLEZ| | |
|MULTIPLEZ_FILE| | |
|MULTIPLEZ_NMAX| | |
|Z_INTERP| | |
|Z_METHOD| | |
|DZ_WIN| | |
|MIN_THRES| | |
|PROB_INTZ| | |
|SPEC_OUT| | |
|CHI2_OUT| | |
|FIR_LIB| | |
|FIR_LMIN| | |
|FIR_CONT| | |
|FIR_SCALE| | |
|FIR_FREESCALE| | |
|FIR_SUBSTELLAR| | |
|PHYS_LIB| | |
|PHYS_CONT| | |
|PHYS_SCALE| | |
|PHYS_NMAX| | |
|MABS_METHOD| | |
|MABS_CONTEXT| | |
|MABS_REF| | |
|MABS_FILT| | |
|MABS_ZBIN| | |
|RF_COLORS| | |
|M_REF| | |
|APPLY_SYSSHIFT| | |
|AUTO_ADAPT| | |
|ERROR_ADAPT| | |
|ADAPT_BAND| | |
|ADAPT_LIM|| |
|ADAPT_CONTEXT| | |
|ADAPT_ZBIN| | |
|ADAPT_MODBIN| | |
|PDZ_OUT| | |
|PDZ_TYPE| | |
|PDZ_MABS_FILT| | |
|ADD_EMLINES| | |
|FAST_MODE| | |
|COL_NUM| | |
|COL_SIGMA| | |
|COL_SEL| | |
|ADDITIONAL_MAG| | |
|LIMITS_ZBIN| | |
|LIMITS_MAPP_REF| | |
|LIMITS_MAPP_SEL| | |
|LIMITS_MAPP_CUT| | |
\ No newline at end of file
|INP_TYPE| F or M | Input values: Flux (F) or Magnitude (M)|
|CAT_TYPE| LONG[def] or SHORT | Input catalog format (long requires at minimum spec-z and context)|
|CAT_MAG| AB[def] or VEGA | Input magnitude type|
|CAT_FMT| MEME[def] or MMEE | Input format for photometry (MEME alternate mag-flux with error)|
|CAT_LINES| 0,10000000000[def] | Min and max rows read in input catalog (to run only a subsample)|
|PARA_OUT| | Name of the file with selected output parameters|
|CAT_OUT| | Name of the output file |
|ZPHOTLIB| | Library names (with no extension). Could have several separated by comma. Should be in LEPHAREWORK/lib_mag. |
|ADD_EMLINES| | Range of galaxy models in which considering emission lines contribution. |
|ERR_SCALE| 0[def] | Systematic errors (in mag) add in quadrature to the observations. One per filter, separated by comma.|
|ERR_FACTOR| 1.0[def] | Scaling factor to the errors (in flux) |
|BD_SCALE| 0[def] | Band used for scaling the models to the observations (sum of 2^i, as context). 0 means all.|
|GLB_CONTEXT| 0[def] | Forces the context of all objects (sum of 2^i, as context). 0 means all. |
|FORB_CONTEXT| 0[def] | context for removing some bands from the fit (sum of 2^i, as context). 0 means inactive.|
|MASS_SCALE| 0, 0[def]| Prior: allowed range in mass|
|MAG_ABS| 0, 0[def]| Prior: Absolute magnitude range allowed for the model)|
|MAG_REF| | Reference filter for the prior in abs. mag. (start at 1) |
|NZ_PRIOR| -1[def] | N(z) prior as function of i-band. Give the rank of i-band filter in input (start at 1). Negative value means no prior. |
|ZFIX| NO[def] or YES | Fixed redshift with the spec-z value|
|EXTERNALZ_FILE| NONE[def] | Use the spec-z from an extrenal file (format Id,zs) |
|Z_INTERP| NO[def] | Parabolic interpolation between original step (dz) |
|DZ_WIN| 0.25[def] | smoothing window function for 2nd peak search in L(z) |
|MIN_THRES| 0.1[def]| threshold for the detection of 2nd peak in normalised L(z) (between 0 and 1)|
|SPEC_OUT| NO[def] | Output files with Gal/Star/QSO spectra (one file per object) |
|CHI2_OUT| NO[def] | Output files with the chi2 for the full library (one file per object) |
|PDZ_OUT| NONE[.pdz] | Output file name in which PDZ will be stored (full path). The code will add automatically the extension[.pdz] |
|PDZ_TYPE| BAY[def] or MIN| Define how the PDF is given in output of OUT\_PDZ.|
|FIR_LIB| NONE[def] | Far-IR libraries separated by comma |
|FIR_LMIN| 7[def] | $\lambda$ min for FIR analysis (in $\mu m$) |
|FIR_CONT| -1[def] | Context for bands to be used in Far-IR |
|FIR_SCALE| -1[def] | Context for bands to be used for scaling |
|FIR_FREESCALE| NO[def] | Allows for free scaling |
|FIR_SUBSTELLAR| NO[def] | Removing stellar component from best optical fit |
|MABS_METHOD| 0[def] or 1 or 2 or 3 or 4 | Method used for absolute magnitudes in each filter |
|Z_METHOD| BEST[def] or ML | compute the absolute magnitude at a given redshift solution ML or BEST |
|MABS_CONTEXT| 0[def] | Context for the bands used to derive Mabs. |
|MABS_REF| 1[def] | Filter used to derive the Mabs if method=2 |
|MABS_FILT| 1[def] | For method 4: list of fixed filters chosen to derive Mabs in all bands according to the redshift bins |
|MABS_ZBIN| 0,6[def] | For method 4: list of Redshift bins associated with MABS_FILT. Even number of values. |
|ADDITIONAL_MAG| | Name of file with filters, to derive Mabs in additional filters |
|RF_COLORS| -1,-1,-1,-1[def] | When computing uncertainties on abs. mag., do it in two colors (4 filters) |
|M_REF| | Filter in which to compute the absolute magnitudes and associated errorbars |
|APPLY_SYSSHIFT| 0[def] | Apply systematic shifts in each bands. Number of values must correspond to the number of filters. |
|AUTO_ADAPT| NO[def] | Optimize zero-points with spec-z |
|ADAPT_BAND| 1[def] | Reference band for the selection in magnitude |
|ADAPT_LIM| 15,35[def] | Mag range for spectro in reference band |
|ADAPT_ZBIN| 0.01,6[def] | Redshift's interval used for training |
|LIMITS_ZBIN| 0.0,90.[def] | Redshift limits used to split in N bins, separated by a coma. |
|LIMITS_MAPP_REF| 1[def] | Compute z-max. Band in which the absolute magnitude is computed. |
|LIMITS_MAPP_SEL| 1[def] | Compute z-max. Give the selection band in each redshift bin. Need 1 or N values.|
|LIMITS_MAPP_CUT| 90[def] | Compute z-max. Magnitude cut used in each redshift bin. Need 1 or N values. |
|RM_DISCREPENT_BD| 200,3[def] | define the threshold in chi2 to consider and the minimum improvement in chi2 expected |
|Z_RANGE| | Not implemented in c++ |
|EBV_RANGE| | Not implemented in c++|
|ADAPT_CONTEXT| | Not implemented in c++ |
|ADAPT_MODBIN| | Not implemented in c++ |
|PROB_INTZ| | Not implemented in c++|
|MAG_ABS_AGN| | Not implemented in c++ |
|CHI2_OUT| | Not implemented in c++ |
|PDZ_MABS_FILT| | Not implemented in c++|
|LIR_PRIOR| | Not implemented in c++ |
|LIR_PRIOR_NEW| | Not implemented in c++|
|ZFORM_MIN| | Not implemented in c++|
|PHYS_LIB| | Not implemented in c++|
|PHYS_CONT| | Not implemented in c++|
|PHYS_SCALE| | Not implemented in c++|
|PHYS_NMAX| | Not implemented in c++|
|FAST_MODE| | Not implemented in c++|
|COL_NUM| | Not implemented in c++|
|COL_SIGMA| | Not implemented in c++|
|COL_SEL| | Not implemented in c++|
|ERROR_ADAPT| | Not implemented in c++ |
# Format used for GAZPAR
IDENT
Z_BEST
MOD_BEST
EBV_BEST
EXTLAW_BEST
CHI_BEST
NBAND_USED
AGE_BEST
AGE_INF
AGE_MED
AGE_SUP
LDUST_BEST
LDUST_INF
LDUST_MED
LDUST_SUP
MASS_BEST
MASS_INF
MASS_MED
MASS_SUP
SFR_BEST
SFR_INF
SFR_MED
SFR_SUP
SSFR_BEST
SSFR_INF
SSFR_MED
SSFR_SUP
LUM_NUV_BEST
LUM_R_BEST
LUM_K_BEST
STRING_INPUT
MAG_ABS()
MAG_OBS()
ERR_MAG_OBS()
# Format used for GAZPAR
#
# BASIC PHOTOZ INFORMATION
IDENT
Z_ML
Z_ML68_LOW
Z_ML68_HIGH
Z_BEST
Z_BEST68_LOW
Z_BEST68_HIGH
# INFORMATIONS ON THE BEST FIT TEMPLATE
CHI_BEST
MOD_BEST
EXTLAW_BEST
EBV_BEST
SCALE_BEST
NBAND_USED
####### Z-2nd GALAXY ###########
Z_SEC
CHI_SEC
MOD_SEC
#
######## Z-Best QSO #############
Z_QSO
CHI_QSO
MOD_QSO
######## Best STAR #############
MOD_STAR
CHI_STAR
# FIT
CONTEXT
ZSPEC
######## OBSERVED MAGNITUDES ####
MAG_OBS()
ERR_MAG_OBS()
######## MODEL MAGNITUDES FOR GALAXY ####
MAG_MOD()
######## K-COR , ABSOLUTE MAG, FILTER CHOICE FOR GALAXY ##########
MAG_ABS()
MABS_FILT()
####### INPUT INFO ##############
STRING_INPUT
Subproject commit e315e1fe2bad553ff541ce3bc00804e0e70583a2
import os
global LEPHAREDIR
LEPHAREDIR = os.getenv('LEPHAREDIR')
from lephare._lephare import get_lephare_env
#make LEPHAREDIR and LEPHAREWORK avaliable to the C++ codes
get_lephare_env()
import os, time
from lephare.runner import Runner
from lephare._lephare import keyword, flt, SED, get_lephare_env, write_output_filter
global filter_config_keys
class Filter(Runner):
def __init__(self):
super().__init__(filter_config_keys)
def run(self):
keymap = {}
for key in filter_config_keys:
keymap[key] = keyword(key, getattr(self.args,key))
fltRep = keymap['FILTER_REP'].split_string(os.path.join(os.environ['LEPHAREDIR'],"filt/"),1)[0]
fltFiles = keymap["FILTER_LIST"].split_string("flt.pb",-99)
ref_size = len(fltFiles)
# Transmission in energy or photons
transtyp = (keymap["TRANS_TYPE"]).split_int("0",ref_size);
# calibration depending on the instrument
calibtyp = (keymap["FILTER_CALIB"]).split_int("0",ref_size)
# Output file
outputName = keymap["FILTER_FILE"].one_string("filters");
filtfile = os.path.join(os.environ["LEPHAREWORK"],"filt", outputName + ".dat")
filtdoc = os.path.join(os.environ["LEPHAREWORK"],"filt", outputName + ".doc")
if self.verbose:
print("#######################################")
print("# Build the filter file with the following options: ")
print("# Config file: {}".format(self.args.config))
print("# FILTER_REP: {}".format(fltRep))
print("# FILTER_LIST: {}".format(fltFiles))
print("# TRANS_TYPE: {}".format(transtyp))
print("# FILTER_CALIB: {}".format(calibtyp))
print("# FILTER_FILE: {}".format(filtfile))
print("# FILTER_FILE.doc: {}".format(filtdoc))
print("#######################################")
vecFlt = []
for k,(f,t,c) in enumerate(zip(fltFiles,transtyp, calibtyp)):
fltFile = os.path.join(fltRep,f)
oneFilt = flt(k, f, t, c)
oneFilt.read(fltFile)
vecFlt.append(oneFilt)
write_output_filter(filtfile, filtdoc, vecFlt)
if __name__ == "__main__":
filter_config_keys = ["FILTER_REP","FILTER_LIST","TRANS_TYPE","FILTER_CALIB","FILTER_FILE"]
runner = Filter()
runner.run()
runner.end()
import os, time
from lephare.runner import Runner
from lephare._lephare import keyword, flt, StarMag, GalMag, QSOMag
global mag_gal_config_keys
class MagGal(Runner):
def __init__(self):
super().__init__(mag_gal_config_keys)
def run(self):
typ = getattr(self.args, 'typ').upper()
if typ[0] == 'G':
Mag = GalMag(self.keymap)
elif typ[0] == 'Q':
Mag = QSOMag(self.keymap)
elif typ[0] == 'S':
Mag = StarMag(self.keymap)
else:
raise KeyError("-t arg must start with G/g Q/q or S/s for Galaxy QSO and Star respectively.")
Mag.open_files()
Mag.print_info()
Mag.read_ext()
Mag.read_opa()
Mag.read_flt()
Mag.def_zgrid()
Mag.read_SED()
Mag.comp_mag()
Mag.write_doc()
return
if __name__ == "__main__":
mag_gal_config_keys = ["COSMOLOGY","FILTER_FILE","MAGTYPE","EXTINC_LAW","EB_V","MOD_EXTINC","ZGRID_TYPE","Z_STEP","GAL_LIB_IN","QSO_LIB_IN","STAR_LIB_IN","GAL_LIB_OUT","QSO_LIB_OUT","STAR_LIB_OUT","LIB_ASCII","EM_LINES","EM_DISPERSION"]
runner = MagGal()
runner.run()
runner.end()
import os, sys
import argparse
import yaml
import time
from lephare._lephare import get_lephare_env, keyword
class Runner(object):
def __init__(self, config_keys=None):
get_lephare_env()
if config_keys is None:
raise RuntimeError("Runner is a base class and cannot be initialized")
self.config_keys = config_keys
self.args = self.config_parser(config_keys)
if self.args.timer:
self.start = time.time()
def parse_config_file(self,filename):
if not os.path.exists(filename):
raise RuntimeError('File %s not found'%filename)
keymap = {}
def config_reader(filename):
for row in open(filename, "r"):
yield row
config = config_reader(filename)
for line in config:
if line[0]!="#" and line!='\n':
splits = line.split()
splits[0].lstrip()#remove leading spaces
if splits[0]!="#":
try:
keymap[splits[0]] = keyword(splits[0], splits[1])
except:
keymap[splits[0]] = keyword(splits[0], "")
if splits[0] in self.config_keys:
self.parser.set_defaults(**{splits[0]:splits[1],})
# self.parser.add_argument("--%s"%(splits[0]), type=str,
# default=splits[1], help=" ".join(splits[3:]))
self.keymap = keymap
def config_parser(self, config_keys):
parser = argparse.ArgumentParser(add_help=False)
#No required positional argument as in the C++ code, though in there
#absence of the config file results in exiting. Need to understand whether
#LePhare executables can be run with all keywords provided at the
#command line
parser.add_argument("-c", "--config", type=str, default="",
help="Path to config file.")
args, unknown = parser.parse_known_args()
self.parser = argparse.ArgumentParser(parser, add_help=True)
self.parser.add_argument("--verbose", help="increase onscreen verbosity",
action="store_true")
self.parser.add_argument("--timer", help="switch timer on to time execution",
action="store_true")
self.parser.add_argument("-c", "--config", type=str, default="",
help="Path to config file.")
if self.__class__.__name__ in ["Sedtolib", "MagGal"]:
self.parser.add_argument("-t", "--typ", type=str, default="",
help="Type of SED object : GAL QSO or STAR", required=True)
#add authorized command line args:
for key in self.config_keys:
self.parser.add_argument("--%s"%key, type=str)
if args.config != "":
self.parse_config_file(args.config)
else:
print("WARNING: no config file provided!")
args = self.parser.parse_args()
for key in self.config_keys:
try:
self.keymap[key] = keyword(key, getattr(args, key))
except:
self.keymap[key] = keyword(key, "")
self.verbose = args.verbose
self.timer = args.timer
return args
def run(self):
raise Exception("runner.py is an abstract class")
def end(self):
if self.args.timer:
print('execution time: %.4g'%(time.time()-self.start))
if __name__ == "__main__":
raise TypeError("Runner is a base class, not an executable")
import os, time
from lephare.runner import Runner
from lephare._lephare import keyword, flt, StarSEDLib, QSOSEDLib, GalSEDLib
global sedtolib_config_keys
class Sedtolib(Runner):
def __init__(self):
super().__init__(sedtolib_config_keys)
def run(self):
typ = getattr(self.args, 'typ').upper()
config = getattr(self.args, 'config')
if typ[0] == 'G':
SEDLibrary = GalSEDLib(self.keymap, config, typ)
elif typ[0] == 'Q':
SEDLibrary = QSOSEDLib(self.keymap, config, typ)
elif typ[0] == 'S':
SEDLibrary = StarSEDLib(self.keymap, config, typ)
else:
raise KeyError("-t arg must start with G/g Q/q or S/s for Galaxy QSO and Star respectively.")
SEDLibrary.print_info()
SEDLibrary.read_model_list()
SEDLibrary.write_SED_lib()
SEDLibrary.print_time_tofile(int(time.time()))
return
if __name__ == "__main__":
sedtolib_config_keys = ["GAL_SED","GAL_FSCALE","GAL_LIB","SEL_AGE","AGE_RANGE","QSO_SED","QSO_FSCALE","QSO_LIB","STAR_SED","STAR_LIB","STAR_FSCALE"]
runner = Sedtolib()
runner.run()
runner.end()
from lephare._lephare import keyword, cosmo
from lephare.runner import Runner
from lephare._lephare import PhotoZ, GalMag #, read_lib, read_doc_filters, readOutKeywords, GalMag, bestFilter, maxkcolor
import sys
import numpy as np
import time
global zphota_config_keys
nonestring = "NONE"
class Zphota(Runner):
def __init__(self):
super().__init__(zphota_config_keys)
# keymap = {}
# for key in zphota_config_keys:
# try:
# keymap[key] = keyword(key, getattr(self.args,key))
# except AttributeError:
# keymap[key] = keyword(key, "")
# config = keymap['config'].value
# typ = keymap['typ'].value.upper()
# self.keymap = keymap
def run(self):
print(self.keymap)
photoz = PhotoZ(self.keymap)
autoadapt = self.keymap["AUTO_ADAPT"]
if autoadapt:
a0, a1 = photoz.run_autoadapt()
offsets=",".join(np.array(a0).astype(str))
offsets = "# Offsets from auto-adapt: " + offsets + '\n'
photoz.outputHeader += offsets
else:
for k in range(photoz.imagm):
a0.append(0.)