Fix linting issues

This commit is contained in:
rasmusvt 2022-04-07 15:39:07 +02:00
parent de8c0ab8d5
commit 3d99af9a7a
3 changed files with 5 additions and 52 deletions

View file

@ -151,9 +151,9 @@ def adjust_plot(fig, ax, options):
# FIXME THIS NEEDS REWORK FOR IT TO FUNCTION PROPERLY!
if options['xticks']:
ax.set_xticks(np.arange(plot_data['start'], plot_data['end']+1))
ax.set_xticklabels(options['xticks'])
#if options['xticks']:
# ax.set_xticks(np.arange(plot_data['start'], plot_data['end']+1))
# ax.set_xticklabels(options['xticks'])
# else:
# ax.set_xticks(np.arange(plot_data['start'], plot_data['end']+1))
# ax.set_xticklabels([x/2 for x in np.arange(plot_data['start'], plot_data['end']+1)])

View file

@ -13,7 +13,7 @@ def rbkerbest():
##Better to make a new function that loops through the files, and performing the split_xanes_scan on
def split_xanes_scan(root, destination=None, replace=False):
def split_xanes_scan(filename, destination=None, replace=False):
#root is the path to the beamtime-folder
#destination should be the path to the processed data

View file

@ -7,6 +7,7 @@ import numpy as np
import math
import ipywidgets as widgets
from IPython.display import display
import beamtime.xrd as xrd
import beamtime.auxillary as aux
@ -657,54 +658,6 @@ def prettify_labels(label):
return labels_dict[label]
def plot_diffractograms(paths, kind, options=None):
fig, ax = prepare_diffractogram_plot(options=options)
diffractograms = []
for path in paths:
diffractogram = xrd.io.read_data(path=path, kind=kind, options=options)
diffractograms.append(diffractogram)
required_options = ['type', 'xvals', 'yvals', 'x_offset', 'y_offset', 'normalise', 'normalise_around', 'reverse_order']
default_options = {
'type': 'stacked',
'xvals': '2th',
'yvals': 'I',
'x_offset': 0,
'y_offset': 0.2,
'normalise': True,
'normalise_around': None,
'reverse_order': False
}
# If reverse_order is enabled, reverse the order
if options['reverse_order']:
diffractograms = reverse_diffractograms(diffractograms)
# If normalise is enbaled, normalise all the diffractograms
if options['normalise']:
if not options['normalise_around']:
for diffractogram in diffractograms:
diffractogram["I"] = diffractogram["I"]/diffractogram["I"].max()
else:
diffractogram["I"] = diffractogram["I"]/diffractogram["I"].loc[(diffractogram['2th'] > options['normalise_around'][0]) & (diffractogram['2th'] < options['normalise_around'][1])].max()
if options['type'] == 'stacked':
for diffractogram in diffractograms:
diffractogram.plot(x=options['xvals'], y=options['yvals'], ax=ax)
fig, ax = prettify_diffractogram_plot(fig=fig, ax=ax, options=options)
return diffractogram, fig, ax
def reverse_diffractograms(diffractograms):