Treat the first 4 letters of proposal as a year

This commit is contained in:
usov_i 2021-04-09 10:14:09 +02:00
parent f43488af34
commit 24f083e585
3 changed files with 15 additions and 15 deletions

View File

@ -62,8 +62,6 @@ for (let i = 0; i < js_data.data['fname'].length; i++) {
}
"""
PROPOSAL_PATH = "/afs/psi.ch/project/sinqdata/2020/zebra/"
def create():
det_data = {}
@ -71,11 +69,13 @@ def create():
js_data = ColumnDataSource(data=dict(content=["", ""], fname=["", ""]))
def proposal_textinput_callback(_attr, _old, new):
ccl_path = os.path.join(PROPOSAL_PATH, new.strip())
proposal = new.strip()
year = new[:4]
proposal_path = f"/afs/psi.ch/project/sinqdata/{year}/zebra/{proposal}"
ccl_file_list = []
for file in os.listdir(ccl_path):
for file in os.listdir(proposal_path):
if file.endswith((".ccl", ".dat")):
ccl_file_list.append((os.path.join(ccl_path, file), file))
ccl_file_list.append((os.path.join(proposal_path, file), file))
file_select.options = ccl_file_list
proposal_textinput = TextInput(title="Proposal number:", width=210)

View File

@ -43,19 +43,19 @@ IMAGE_H = 128
IMAGE_PLOT_W = int(IMAGE_W * 2.5)
IMAGE_PLOT_H = int(IMAGE_H * 2.5)
PROPOSAL_PATH = "/afs/psi.ch/project/sinqdata/2020/zebra/"
def create():
det_data = {}
roi_selection = {}
def proposal_textinput_callback(_attr, _old, new):
full_proposal_path = os.path.join(PROPOSAL_PATH, new.strip())
proposal = new.strip()
year = new[:4]
proposal_path = f"/afs/psi.ch/project/sinqdata/{year}/zebra/{proposal}"
file_list = []
for file in os.listdir(full_proposal_path):
for file in os.listdir(proposal_path):
if file.endswith(".hdf"):
file_list.append((os.path.join(full_proposal_path, file), file))
file_list.append((os.path.join(proposal_path, file), file))
filelist.options = file_list
filelist.value = file_list[0][0]

View File

@ -66,8 +66,6 @@ for (let i = 0; i < js_data.data['fname'].length; i++) {
}
"""
PROPOSAL_PATH = "/afs/psi.ch/project/sinqdata/2020/zebra/"
def color_palette(n_colors):
palette = itertools.cycle(Category10[10])
@ -80,11 +78,13 @@ def create():
js_data = ColumnDataSource(data=dict(content=["", ""], fname=["", ""]))
def proposal_textinput_callback(_attr, _old, new):
full_proposal_path = os.path.join(PROPOSAL_PATH, new.strip())
proposal = new.strip()
year = new[:4]
proposal_path = f"/afs/psi.ch/project/sinqdata/{year}/zebra/{proposal}"
dat_file_list = []
for file in os.listdir(full_proposal_path):
for file in os.listdir(proposal_path):
if file.endswith(".dat"):
dat_file_list.append((os.path.join(full_proposal_path, file), file))
dat_file_list.append((os.path.join(proposal_path, file), file))
file_select.options = dat_file_list
proposal_textinput = TextInput(title="Proposal number:", width=210)