'sources': 'ZTF_sources_20200401' } outputDir = opts.outputDir algorithms = opts.algorithms.split(",") plotDir = os.path.join(outputDir, 'plots') if not os.path.isdir(plotDir): os.makedirs(plotDir) kow = [] nquery = 10 cnt = 0 while cnt < nquery: try: kow = Kowalski(username=opts.user, password=opts.pwd) break except: time.sleep(5) cnt = cnt + 1 if cnt == nquery: raise Exception('Kowalski connection failed...') nquery = 10 cnt = 0 while cnt < nquery: try: zvmarshal = zvm(username=str(opts.zvm_user), password=str(opts.zvm_pwd), verbose=True, host="rico.caltech.edu")
from ...models import ( DBSession, Obj, Source, Candidate, User, Token, Group, Spectrum, CronJobRun, ) _, cfg = load_env() kowalski = Kowalski( token=cfg["app.kowalski.token"], protocol=cfg["app.kowalski.protocol"], host=cfg["app.kowalski.host"], port=int(cfg["app.kowalski.port"]), ) class StatsHandler(BaseHandler): @permissions(["System admin"]) def get(self): """ --- description: Retrieve basic DB statistics tags: - system_info responses: 200: content:
import csv # load dataset parser = argparse.ArgumentParser() parser.add_argument("inputfile") parser.add_argument("--id", type=int, default=1, help="group id on Fritz") args = parser.parse_args() with open(args.inputfile) as f: data = csv.reader(f) trainingset = pd.DataFrame(data) # Kowalski with open('password.txt', 'r') as f: password = f.read().splitlines() G = Kowalski(username=password[0], password=password[1], host='gloria.caltech.edu', timeout=1000) # get scores and data and combine scores = get_highscoring_objects(G, otype='vnv', condition='$or') index = scores.index condition = ((scores["vnv_dnn"] > 0.95) & (scores['vnv_xgb'] <= 0.1)) | ((scores["vnv_dnn"] <= 0.1) & (scores['vnv_xgb'] > 0.95)) disagreements = index[condition] disagreeing_scores = scores.iloc[disagreements, :] stats = get_stats(G, disagreeing_scores['_id']) data = pd.merge(disagreeing_scores, stats, left_on='_id', right_on='_id') data['train'] = np.isin(data['_id'], trainingset['ztf_id'])