Commit 42f1e16f authored by Miroslav Shaltev's avatar Miroslav Shaltev
Browse files

begin work on HybridSearch

parent 8136acf0
# source this file to access 'cwseaoptifol'
if ( ! ${?LAL_DATA_PATH} ) setenv LAL_DATA_PATH
setenv LAL_DATA_PATH `echo ":${LAL_DATA_PATH}:" | /bin/sed 's|:/home/shaltev/cwsof/share/cwseaoptifol:|:|;s|::*|:|g;s|^:||;s|:$||'`
setenv LAL_DATA_PATH "/home/shaltev/cwsof/share/cwseaoptifol:${LAL_DATA_PATH}"
if ( ! ${?PYTHONPATH} ) setenv PYTHONPATH
setenv PYTHONPATH `echo ":${PYTHONPATH}:" | /bin/sed 's|::*|:|g;s|^:||;s|:$||'`
setenv PYTHONPATH "${PYTHONPATH}"
if ( ! ${?MANPATH} ) setenv MANPATH
setenv MANPATH `echo ":${MANPATH}:" | /bin/sed 's|:/home/shaltev/cwsof/share/man:|:|;s|::*|:|g;s|^:||;s|:$||'`
setenv MANPATH "/home/shaltev/cwsof/share/man:${MANPATH}"
if ( ! ${?PATH} ) setenv PATH
setenv PATH `echo ":${PATH}:" | /bin/sed 's|:/home/shaltev/cwsof/bin:|:|;s|::*|:|g;s|^:||;s|:$||'`
setenv PATH "/home/shaltev/cwsof/bin:${PATH}"
# source this file to access 'cwseaoptifol'
LAL_DATA_PATH=`echo ":${LAL_DATA_PATH}:" | /bin/sed 's|:/home/shaltev/cwsof/share/cwseaoptifol:|:|;s|::*|:|g;s|^:||;s|:$||'`
LAL_DATA_PATH="/home/shaltev/cwsof/share/cwseaoptifol:${LAL_DATA_PATH}"
export LAL_DATA_PATH
PYTHONPATH=`echo ":${PYTHONPATH}:" | /bin/sed 's|::*|:|g;s|^:||;s|:$||'`
PYTHONPATH="${PYTHONPATH}"
export PYTHONPATH
MANPATH=`echo ":${MANPATH}:" | /bin/sed 's|:/home/shaltev/cwsof/share/man:|:|;s|::*|:|g;s|^:||;s|:$||'`
MANPATH="/home/shaltev/cwsof/share/man:${MANPATH}"
export MANPATH
PATH=`echo ":${PATH}:" | /bin/sed 's|:/home/shaltev/cwsof/bin:|:|;s|::*|:|g;s|^:||;s|:$||'`
PATH="/home/shaltev/cwsof/bin:${PATH}"
export PATH
......@@ -121,6 +121,8 @@ def getcmdline():
help = "Final maximal mesh coarsening exponent [default: 1]", default = 2)
p.add_option("--nB", action = "store", dest = "nB",\
help = "nB [default: 24]", default = 24)
p.add_option("--MeshType", action = "store", dest = "MeshType",\
help = "mesh type [default: 0]", default = 0)
p.add_option("--MeshUpdateBasis", action = "store", dest = "MeshUpdateBasis",\
help = "mesh update basis [default: 2]", default = 2)
p.add_option("--FinalMeshUpdateBasis", action = "store", dest = "FinalMeshUpdateBasis",\
......@@ -308,6 +310,7 @@ def get_offset_signal(signal,semig,directedsearch,c,bands):
offsignal['f1dot'] = tc[offcnt + 1]
offsignal['f2dot'] = tc[offcnt + 2]
offsignal['f3dot'] = tc[offcnt + 3]
offsignal['m'] = m
point_not_inside = False
return offsignal
......@@ -385,6 +388,7 @@ def get_hdim_offset_signal(signal,semig,directedsearch,c,bands):
print res_x
print 'check m: ',check_m
offsignal['m'] = check_m
offsignal['Alpha'] = res_x[0]
offsignal['Delta'] = res_x[1]
offsignal['Freq'] = res_x[2]
......@@ -842,20 +846,25 @@ def FStatNomad(p):
--MinMeshSize="%e" --MinPollSize="%e" --MaxIterations="%d" \
--ModelSearch="%d" --ModelEvalSort="%d" --VnsSearch="%f" \
--MinMeshCoarseningExponent="%d" --MaxMeshCoarseningExponent="%d" \
--FinalMinMeshCoarseningExponent="%d" --FinalMaxMeshCoarseningExponent="%d" \
--nB="%f" --LoopMeshCoarseningExponent \
--StepMeshCoarseningExponent="%d" --MaxBBEval="%d" \
--avg2F="%f" --SSBprecision="%d" \
--FStatSearchType="%d" --SemicoherentStages="%d" \
--MeshType="%d" --MeshUpdateBasis="%f" --FinalMeshUpdateBasis="%f" \
--NoiseLimit="%f" --MetricIFO="%s" --metricType="0"' % \
(p['nmd'], p['Alpha'], p['Delta'], p['Freq'], p['f1dot'], p['f2dot'], p['f3dot'], \
p['DataFiles'], p['ephemE'], p['ephemS'], p['fnameout'], p['refTime'], p['segmentList'],\
p['Type'], p['Epsilon'], p['DisplayDegree'], p['MinMeshSize'], p['MinPollSize'],\
p['MaxIterations'], p['ModelSearch'],p['ModelEvalSort'],\
p['VnsSearch'],p['MinMeshCoarseningExponent'],\
p['MaxMeshCoarseningExponent'],p['nB'],\
p['MaxMeshCoarseningExponent'],\
p['FinalMinMeshCoarseningExponent'],\
p['FinalMaxMeshCoarseningExponent'], p['nB'],\
p['StepMeshCoarseningExponent'],p['MaxBBEval'],\
p['avg2F'],p['SSBprecision'],p['FStatSearchType'],\
p['SemicoherentStages'],\
p['MeshType'],p['MeshUpdateBasis'],p['FinalMeshUpdateBasis'],\
p['NoiseLimit'],p['MetricIFO'])
if p['UseMetric']:
cmd = cmd + ' --UseMetric'
......@@ -963,18 +972,18 @@ def do_nomad_search(c,segments,workdir,sg,signal,offsignal,directedsearch):
p['nmd'] = c['nmd']
p['ephemE'] = c['ephemE']
p['ephemS'] = c['ephemS']
p['FreqBand'] = 2*2*dFreq
p['FreqBand'] = 2*dFreq
p['Freq'] = offsignal['Freq'] - 0.5*p['FreqBand']
p['f1dotBand'] = 2*2*df1dot
p['f1dotBand'] = 4*df1dot
p['f1dot'] = offsignal['f1dot'] - 0.5*p['f1dotBand']
p['f2dotBand'] = 2*2*df2dot
p['f2dotBand'] = 4*df2dot
p['f2dot'] = offsignal['f2dot'] - 0.5*p['f2dotBand']
p['f3dotBand'] = 2*2*df3dot
p['f3dotBand'] = 4*df3dot
p['f3dot'] = offsignal['f3dot'] - 0.5*p['f3dotBand']
p['fnameout'] = workdir + '/fsnomad'
p['refTime'] = c['refTime']
p['segmentList'] = c['segments']
p['AlphaBand'] = 2*2*dAlpha
p['AlphaBand'] = 2*dAlpha
p['Alpha'] = offsignal['Alpha'] - 0.5*p['AlphaBand']
if p['Alpha'] < 0:
p['Alpha'] = 0.00001
......@@ -983,7 +992,7 @@ def do_nomad_search(c,segments,workdir,sg,signal,offsignal,directedsearch):
if p['AlphaBand'] > 2*pi:
print 'crop Alpha band from %f to %f'%(p['AlphaBand'],2*pi-p['Alpha'])
p['AlphaBand'] = 2*pi - p['Alpha']
p['DeltaBand'] = 2*2*dDelta
p['DeltaBand'] = 2*dDelta
p['Delta'] = offsignal['Delta'] - 0.5*p['DeltaBand']
if p['Delta'] < -0.5*pi:
p['Delta'] = -0.5*pi
......@@ -1017,8 +1026,9 @@ def do_nomad_search(c,segments,workdir,sg,signal,offsignal,directedsearch):
p['MeshRefiningExponent'] = -1
p['MeshUpdateBasis'] = c['MeshUpdateBasis']
p['FinalMeshUpdateBasis'] = c['FinalMeshUpdateBasis']
p['MeshType'] = c['MeshType']
p['MetricIFO'] = c['MetricIFO']
p['BreakASAP'] = 0
p['BreakASAP'] = 1
p['AcceptDev'] = 6
p['DataFiles'] = workdir + '/signal*.sft'
......@@ -1359,6 +1369,7 @@ def main():
c['nB'] = int(o.nB)
c['MeshUpdateBasis'] = float(o.MeshUpdateBasis)
c['FinalMeshUpdateBasis'] = float(o.FinalMeshUpdateBasis)
c['MeshType'] = int(o.MeshType)
c['NoiseLimit'] = float(o.NoiseLimit)
c['ltmads'] = float(o.ltmads)
c['finalltmads'] = float(o.finalltmads)
......@@ -1559,7 +1570,7 @@ def main():
# collect data
d = []
d.append(avgsnrsq)
d.append(m)
d.append(offsignal['m'])
t = loadtxt(workdir + '/fsnomad.pfs',comments="%")
d.append(t[3])
d.append(signal['Alpha'])
......@@ -1639,10 +1650,10 @@ def main():
print cmd
cmdout = commands.getoutput(cmd)
print cmdout
cmd = 'cp %s/*.cache %s/%s/'%(workdir,c['targetdir'],tmpid)
print cmd
cmdout = commands.getoutput(cmd)
print cmdout
#cmd = 'cp %s/*.cache %s/%s/'%(workdir,c['targetdir'],tmpid)
#print cmd
#cmdout = commands.getoutput(cmd)
#print cmdout
#final clean
shellrmdir(workdir)
......
......@@ -590,6 +590,10 @@ int main(int argc, char *argv[]) {
MFCSearch->compute_metric(semig,segList,MFCSearch->SType(),&p,USETYPE_SEARCH,MFCSearch->uvar->metricType);
MFCSearch->Semicohmetric(semig);
}
if (MFCSearch->HybridSearch()) {
MFCSearch->HybridSearchCreateLattice(MFCSearch->Semicohmetric(),MFCSearch->HybridSearchMismatch(),MFCSearch->HybridSearchLattice());
}
NOMAD::Display out ( std::cout );
......@@ -1335,7 +1339,13 @@ INT4 FCSearch::XLALInitUserVars ( int argc, char *argv[] )
uvar->FinalRoundStatDigit = 1;
uvar->BinarySearch = FALSE;
uvar->BNSLEL = TRUE;
uvar->HybridSearch = FALSE;
uvar->HybridSearchMismatch = 0.1;
uvar->HybridSearchLattice = (char*)LALCalloc( 16, sizeof(CHAR) );
strcpy(uvar->HybridSearchLattice, "an-star");
uvar->HybridSearchPoints = 16;
uvar->metricType = MTAVFSTAT;
SignalIsKnown = FALSE;
......@@ -1493,6 +1503,10 @@ INT4 FCSearch::XLALInitUserVars ( int argc, char *argv[] )
XLALRegisterUvarMember( FinalRoundStatDigit,INT4, 0, OPTIONAL, "Final rounding precision");
XLALRegisterUvarMember( BinarySearch,BOOLEAN, 0, OPTIONAL, "Do binary search");
XLALRegisterUvarMember( BNSLEL,BOOLEAN, 0, DEVELOPER, "Use low-eccentricity approximation to compute BNS metric [only TRUE is supported for now!]");
XLALRegisterUvarMember( HybridSearch,BOOLEAN, 0, OPTIONAL, "Do hybrid search (grid search in the Nomad search step)");
XLALRegisterUvarMember( HybridSearchMismatch,REAL8, 0, OPTIONAL, "Hybrid search maximal mismatch");
XLALRegisterUvarMember( HybridSearchLattice,STRING, 0, OPTIONAL, "Hybrid search lattice type: 'an-star' or 'cubic'");
XLALRegisterUvarMember( HybridSearchPoints,INT4, 0, OPTIONAL, "Hybrid search number of points");
XLALRegisterUvarMember( metricType, INT4, 0, OPTIONAL, "Type of metric to compute: 0=phase-metric, 1=average F-metric");
/* read cmdline & cfgfile */
......
......@@ -170,6 +170,11 @@ extern "C" {
BOOLEAN BinarySearch;
BOOLEAN BNSLEL;
BOOLEAN HybridSearch;
REAL8 HybridSearchMismatch;
CHAR *HybridSearchLattice;
INT4 HybridSearchPoints;
INT4 metricType;
} UserInput_t;
......
......@@ -713,7 +713,7 @@ void FStatNomad::init_SP(INT4 fstatsearchtype, LALSegList *segmentList) {
LogPrintf(LOG_NORMAL,"number of detectors: %d\n",Ndet());
LogPrintf(LOG_DEBUG,"Nseg: %d\texp2F: %f\tsigma2F: %f\n",INT4(Nseg()),exp2F(),sigma2F());
return 0;
return;
} /* SEARCH_SP */
......@@ -3238,6 +3238,39 @@ FStatNomad::FStatNomad() {
FStatNomad::~FStatNomad() {};
void FStatNomad::HybridSearchCreateLattice(gsl_matrix *g, REAL4 m,CHAR *lattice) {
LatticeTiling *tiling = NULL;
tiling = XLALCreateLatticeTiling(SType());
XLAL_CHECK_MAIN(tiling != NULL, XLAL_EFUNC);
// set bounds for each dimension
for (INT4 i = 0; i < directions.size(); i++) {
XLAL_CHECK_MAIN(XLALSetLatticeTilingConstantBound(tiling, i, directions.at(i).min, directions.at(i).max) == XLAL_SUCCESS, XLAL_EFUNC);
}
const size_t n = XLALTotalLatticeTilingDimensions(tiling);
// Set lattice and metric
XLAL_CHECK_MAIN(XLALSetTilingLatticeAndMetric(tiling, lattice, g, m) == XLAL_SUCCESS, XLAL_EFUNC);
// Create a lattice iterator
LatticeTilingIterator *itr = XLALCreateLatticeTilingIterator(tiling, n);
XLAL_CHECK_MAIN(itr != NULL, XLAL_EFUNC);
// Print number of templates
UINT8 ntemplates = XLALTotalLatticeTilingPoints(itr);
XLAL_CHECK_MAIN(ntemplates > 0, XLAL_EFUNC);
printf("%" LAL_UINT8_FORMAT "\n", ntemplates);
}
/**
* XLAL function to get a list of detector IDs from multi-segment multiSFT vectors
* returns all unique detector IDs for cases with some detectors switching on and off
......@@ -3280,3 +3313,73 @@ XLALGetDetectorIDs(
} /* XLALGetDetectorIDs() */
void SCHybridSearch::search ( NOMAD::Mads &mads, int &nb_search_pts, bool &stop, NOMAD::stop_type &stop_reason, NOMAD::success_type &success, bool &count_search , const NOMAD::Eval_Point *& new_feas_inc, const NOMAD::Eval_Point *& new_infeas_inc ) {
new_feas_inc = new_infeas_inc = NULL;
nb_search_pts = 0;
success = NOMAD::UNSUCCESSFUL;
count_search = !stop;
if ( stop ) {
return;
}
// initial display:
const NOMAD::Display &out = _p.out();
NOMAD::dd_type display_degree = out.get_search_dd();
if ( display_degree == NOMAD::FULL_DISPLAY ){
std::ostringstream oss;
oss << NOMAD::VNS_SEARCH;
out << std::endl << NOMAD::open_block ( oss.str() ) << std::endl;
}
bool opt_only_sgte = _p.get_opt_only_sgte();
// the barriers:
NOMAD::Barrier & true_barrier = mads.get_true_barrier();
NOMAD::Barrier & sgte_barrier = mads.get_sgte_barrier();
const NOMAD::Barrier & active_barrier = mads.get_active_barrier();
// point x:
NOMAD::Double best_f;
bool x_feas = true;
const NOMAD::Eval_Point * x = active_barrier.get_best_feasible();
if ( x ) {
best_f = x->get_f();
}
else {
x = active_barrier.get_best_infeasible();
x_feas = false;
}
if ( !x ) {
if ( display_degree == NOMAD::FULL_DISPLAY ) {
out.close_block ( "end of HybridSearch (no incumbent)" );
}
return;
}
// get the signature:
NOMAD::Signature * signature = x->get_signature();
if ( !signature )
{
if ( display_degree == NOMAD::FULL_DISPLAY )
out.close_block ( "end of HybridSearch (no signature)" );
return;
}
int n = signature->get_n();
if ( n != x->size() ){
if ( display_degree == NOMAD::FULL_DISPLAY )
out.close_block ( "end of HybridSearch (incompatible signature)" );
return;
}
// build template bank
}
void FCHybridSearch::search ( NOMAD::Mads &mads, int &nb_search_pts, bool &stop, NOMAD::stop_type &stop_reason, NOMAD::success_type &success, bool &count_search , const NOMAD::Eval_Point *& new_feas_inc, const NOMAD::Eval_Point *& new_infeas_inc ) {
}
......@@ -70,6 +70,7 @@
#include <lal/UniversalDopplerMetric.h>
#include <lal/StringVector.h>
#include <lal/LALString.h>
#include <lal/LatticeTiling.h>
/* lalapps includes */
#include <lalapps.h>
......@@ -383,6 +384,20 @@ private:
int s;
};
class SCHybridSearch : public NOMAD::Search {
public:
SCHybridSearch ( NOMAD::Parameters & p ):NOMAD::Search ( p , NOMAD::USER_SEARCH ) {}
~SCHybridSearch ( void ) {}
void search ( NOMAD::Mads & mads, int &nb_search_pts, bool &stop, NOMAD::stop_type &stop_reason, NOMAD::success_type &success, bool &count_search, const NOMAD::Eval_Point *& new_feas_inc, const NOMAD::Eval_Point *& new_infeas_inc);
};
class FCHybridSearch : public NOMAD::Search {
public:
FCHybridSearch ( NOMAD::Parameters & p ):NOMAD::Search ( p , NOMAD::USER_SEARCH ) {}
~FCHybridSearch ( void ) {}
void search ( NOMAD::Mads & mads, int &nb_search_pts, bool &stop, NOMAD::stop_type &stop_reason, NOMAD::success_type &success, bool &count_search, const NOMAD::Eval_Point *& new_feas_inc, const NOMAD::Eval_Point *& new_infeas_inc);
};
class FStatNomad {
public:
FStatNomad();
......@@ -1962,10 +1977,43 @@ public:
INT4 Ndet() {
return var_Ndet;
};
}
void Ndet(INT4 v) {
var_Ndet = v;
};
}
void HybridSearch(BOOLEAN v){
var_HybridSearch = v;
}
BOOLEAN HybridSearch(){
return var_HybridSearch;
}
void HybridSearchMismatch(REAL8 v){
var_HybridSearchMismatch = v;
}
REAL8 HybridSearchMismatch(){
return var_HybridSearchMismatch;
}
void HybridSearchLattice(CHAR* v){
var_HybridSearchLattice = v;
}
CHAR* HybridSearchLattice(){
return var_HybridSearchLattice;
}
void HybridSearchPoints(INT4 v){
var_HybridSearchPoints = v;
}
INT4 HybridSearchPoints(){
return var_HybridSearchPoints;
}
REAL8 DoPredictFStat(INT4 fstatsearchtype,LALSegList *segList);
UsefulStageVariables usefulParams;
......@@ -1982,6 +2030,9 @@ public:
INT4 Nsegi[6];
void HybridSearchCreateLattice(gsl_matrix *g, REAL4 m,CHAR *lattice);
MultiSFTVector *multiSFTs;
NOMAD::Cache *cache() {
return nomad_cache;
......@@ -2068,6 +2119,11 @@ private:
REAL8 var_SignalEcc;
REAL8 var_SignalPeriod;
BOOLEAN var_HybridSearch;
REAL4 var_HybridSearchMismatch;
CHAR *var_HybridSearchLattice;
INT4 var_HybridSearchPoints;
UINT8 trials_cnt;
std::vector<UINT8> trials_vec;
......
/* LALAppsBuildInfoHeader.h: generated by Makefile */
#define _CONFIGURE_ARGS ""
#define _CONFIGURE_DATE ""
#define _BUILD_DATE "2017-01-02T19:08:28+0200"
/*
* Copyright (C) 2014, 2016 Karl Wette
* Copyright (C) 2009-2013 Adam Mercer
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with with program; see the file COPYING. If not, write to the
* Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
/*
* cwseaoptifolVCSInfo.h - cwseaoptifol VCS Information Header
*/
/** \cond DONT_DOXYGEN */
#ifndef _CWSEAOPTIFOLVCSINFOHEADER_H
#define _CWSEAOPTIFOLVCSINFOHEADER_H
#include <lal/LALVCSInfoType.h>
#include "LALAppsVCSInfo.h"
#ifdef __cplusplus
extern "C" {
#endif
/* VCS information */
#define CWSEAOPTIFOL_VCS_ID "f9d30562b21ba6ab2dec9175e0ea7d1db910afaf"
#define CWSEAOPTIFOL_VCS_DATE "2017-01-2 12:03:44 +0000"
#define CWSEAOPTIFOL_VCS_BRANCH "master"
#define CWSEAOPTIFOL_VCS_TAG "None"
#define CWSEAOPTIFOL_VCS_AUTHOR "Miroslav Shaltev <miroslav.shaltev@shaltev.de>"
#define CWSEAOPTIFOL_VCS_COMMITTER "Miroslav Shaltev <miroslav.shaltev@shaltev.de>"
#define CWSEAOPTIFOL_VCS_CLEAN "UNCLEAN"
#define CWSEAOPTIFOL_VCS_STATUS "UNCLEAN: Modified working tree"
/* VCS header/library mismatch link check function */
#define CWSEAOPTIFOL_VCS_LINK_CHECK CWSEAOPTIFOL_UNCLEAN_f9d30562b21ba6ab2dec9175e0ea7d1db910afaf_VCS_HEADER_LIBRARY_MISMATCH
void CWSEAOPTIFOL_VCS_LINK_CHECK(void);
#ifdef __cplusplus
}
#endif
#endif /* _CWSEAOPTIFOLVCSINFOHEADER_H */
/** \endcond */
# -*- coding: utf-8 -*-
# git_version.py - vcs information module
#
# Copyright (C) 2010 Nickolas Fotopoulos
# Copyright (C) 2012-2013 Adam Mercer
# Copyright (C) 2016 Leo Singer
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with with program; see the file COPYING. If not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
id = "f9d30562b21ba6ab2dec9175e0ea7d1db910afaf"
date = "2017-01-2 12:03:44 +0000"
branch = "master"
tag = "None"
if tag == "None":
tag = None
author = "Miroslav Shaltev <miroslav.shaltev@shaltev.de>"
builder = "Miroslav Shaltev <miroslav.shaltev@shaltev.de>"
committer = "Miroslav Shaltev <miroslav.shaltev@shaltev.de>"
status = "UNCLEAN: Modified working tree"
version = id
verbose_msg = """Branch: master
Tag: None
Id: f9d30562b21ba6ab2dec9175e0ea7d1db910afaf
Builder: Miroslav Shaltev <miroslav.shaltev@shaltev.de>
Repository status: UNCLEAN: Modified working tree"""
import warnings
class VersionMismatchError(ValueError):
pass
def check_match(foreign_id, onmismatch="raise"):
"""
If foreign_id != id, perform an action specified by the onmismatch
kwarg. This can be useful for validating input files.
onmismatch actions:
"raise": raise a VersionMismatchError, stating both versions involved
"warn": emit a warning, stating both versions involved
"""
if onmismatch not in ("raise", "warn"):
raise ValueError(onmismatch + " is an unrecognized value of onmismatch")
if foreign_id == "f9d30562b21ba6ab2dec9175e0ea7d1db910afaf":
return
msg = "Program id (f9d30562b21ba6ab2dec9175e0ea7d1db910afaf) does not match given id (%s)." % foreign_id
if onmismatch == "raise":
raise VersionMismatchError(msg)
# in the backtrace, show calling code
warnings.warn(msg, UserWarning)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment