tick fix + check that all files exist before starting
This commit is contained in:
parent
56efcface5
commit
dbc3c408a3
1 changed files with 8 additions and 5 deletions
|
@ -1,6 +1,7 @@
|
|||
import numpy as np
|
||||
|
||||
import sys
|
||||
import os
|
||||
sys.path.append('/home/aubin/Simbelmyne/sbmy_control/')
|
||||
|
||||
fs = 18
|
||||
|
@ -10,11 +11,11 @@ def add_ax_ticks(ax, ticks, tick_labels):
|
|||
from matplotlib import ticker
|
||||
ax.set_xticks(ticks)
|
||||
ax.set_yticks(ticks)
|
||||
ax.set_xticklabels(tick_labels)
|
||||
ax.set_yticklabels(tick_labels)
|
||||
ax.set_xticklabels([int(t) for t in tick_labels])
|
||||
ax.set_yticklabels([int(t) for t in tick_labels])
|
||||
ax.set_xlabel('Mpc/h')
|
||||
ax.xaxis.set_major_formatter(ticker.FormatStrFormatter('%d'))
|
||||
ax.yaxis.set_major_formatter(ticker.FormatStrFormatter('%d'))
|
||||
# ax.xaxis.set_major_formatter(ticker.FormatStrFormatter('%d')) # Does not work
|
||||
# ax.yaxis.set_major_formatter(ticker.FormatStrFormatter('%d'))
|
||||
|
||||
|
||||
|
||||
|
@ -53,7 +54,7 @@ def plot_imshow_with_reference( data_list,
|
|||
sep = 10 if L[0] < 50 else 20 if L[0] < 100 else 50 if L[0]<250 else 100 if L[0] < 500 else 200 if L[0] < 1000 else 500 if L[0] < 2500 else 1000
|
||||
ticks = [np.arange(0, l+1, sep)*len(dat)/l for l, dat in zip(L,data_list)]
|
||||
tick_labels = [np.arange(0, l+1, sep) for l in L]
|
||||
|
||||
|
||||
def score(data, reference):
|
||||
return np.linalg.norm(data-reference)/np.linalg.norm(reference)
|
||||
|
||||
|
@ -177,6 +178,8 @@ if __name__ == "__main__":
|
|||
ref_field = read_field(args.directory+args.reference) if args.reference is not None else None
|
||||
fields = []
|
||||
for k,f in enumerate(args.filenames):
|
||||
if not os.path.exists(args.directory+f):
|
||||
raise FileNotFoundError(f"File {args.directory+f} does not exist.")
|
||||
if args.reference is not None and f == args.reference:
|
||||
fields.append(ref_field) # Simply copy the reference field instead of reading it again
|
||||
if args.labels is not None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue