text
stringlengths
1
93.6k
style=f'qn1:+l"{road.Name}"+f8p,Palatino-BoldItalic,gray10+i+jBC+v',
)
# Plot towns as squares
fig.plot(
x=gdf_shire_towns.geometry.x,
y=gdf_shire_towns.geometry.y,
style="s0.3c",
color="black",
)
# Overlay town names one by one
for _, town in gdf_shire_towns.iterrows():
justify = "TL" if town.Name == "Bywater" else "BR"
text = town.Name.split()[0]
fig.text(
x=town.geometry.x,
y=town.geometry.y,
text=text,
justify=justify,
offset="j0.1c/0.2c",
font="12p,NewCenturySchlbk-BoldItalic",
)
# Plot title text on top left corner
fig.text(
position="TL",
text="The Shire",
offset="0.7c/-0.7c",
font="36p,ZapfChancery-MediumItalic,black",
)
# Plot directional rose on top right corner
# https://docs.generic-mapping-tools.org/6.2/cookbook/features.html#placing-dir-map-roses
with pygmt.config(FONT_TITLE="10p,ZapfChancery-MediumItalic"):
fig.basemap(rose="jTR+w1.5c+f3+l+o1c")
# Plot a scalebar on bottom left corner, need to give
# a random projection and region for fancy scale to work
# https://docs.generic-mapping-tools.org/6.2/cookbook/features.html#placing-map-scales
with pygmt.config(FONT_LABEL="ZapfChancery-MediumItalic"):
fig.basemap(
region=[-130, -70, 24, 52],
projection="EPSG:3034",
map_scale="jBL+w500M+lMiles+f+o0.5c",
)
fig.savefig(fname="day24_historical.png")
fig.show()
# <FILESEP>
#!/usr/bin/env python
import numpy as np
import pandas as pd
import click as ck
from tensorflow.keras.models import Sequential, Model, load_model
from tensorflow.keras.layers import (
Dense, Dropout, Activation, Input, Reshape,
Flatten, BatchNormalization, Embedding,
Conv1D, MaxPooling1D, Add, Concatenate)
from tensorflow.keras.optimizers import Adam, RMSprop, Adadelta, SGD
from sklearn.metrics import classification_report
from sklearn.metrics.pairwise import cosine_similarity
from tensorflow.keras.callbacks import EarlyStopping, ModelCheckpoint
import sys
from collections import deque
import time
import logging
import tensorflow as tf
from sklearn.metrics import roc_curve, auc, matthews_corrcoef
from scipy.spatial import distance
from scipy import sparse
import math
from utils import FUNC_DICT, Ontology, NAMESPACES
from matplotlib import pyplot as plt
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO)
@ck.command()
@ck.option(
'--train-data-file', '-trdf', default='data/train_data.pkl',
help='Data file with training features')
@ck.option(
'--test-data-file', '-tsdf', default='data/test_data.pkl',
help='Data file with test')
@ck.option(
'--diamond-scores-file', '-dsf', default='data/test_diamond.res',
help='Diamond output')
@ck.option(
'--ont', '-o', default='mf',
help='GO subontology (bp, mf, cc)')
def main(train_data_file, test_data_file, diamond_scores_file, ont):
go_rels = Ontology('data/go.obo', with_rels=True)
train_df = pd.read_pickle(train_data_file)
annotations = train_df['prop_annotations'].values
annotations = list(map(lambda x: set(x), annotations))