Skip to content

Commit

Permalink
Merge branch 'xraypy:master' into struct2xasV2407
Browse files Browse the repository at this point in the history
  • Loading branch information
maurov authored Sep 20, 2024
2 parents ae22ae4 + 31421d2 commit bddd35c
Show file tree
Hide file tree
Showing 18 changed files with 2,515 additions and 175 deletions.
867 changes: 867 additions & 0 deletions examples/Jupyter/XAFS_Processing_bokeh.ipynb

Large diffs are not rendered by default.

142 changes: 107 additions & 35 deletions examples/Jupyter/XAFS_Processing_matplotlib.ipynb

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions larch/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@ def make_desktop_shortcut(self, folder='Larch'):
bindir = Path(sys.prefix, bindir).absolute()
script = self.script
if not self.script.startswith('_'):
script = Path(bindir, self.script).absolute()
script = Path(bindir, self.script).absolute().as_posix()

icon = Path(icondir, self.icon)
icon = Path(icondir, self.icon).absolute()
if isinstance(ico_ext, (list, tuple)):
for ext in ico_ext:
ticon = f"{self.icon:s}.{ext:s}"
if Path(ticon).exists():
ticon = Path(f"{self.icon:s}.{ext:s}").absolute()
if ticon.exists():
icon = ticon

make_shortcut(script, name=self.name, folder=folder, icon=icon,
make_shortcut(script, name=self.name, folder=folder,
icon=icon.as_posix(),
description=self.description,
terminal=(not self.is_wxapp))

Expand Down
5 changes: 2 additions & 3 deletions larch/inputText.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
#
# InputText for Larch

from __future__ import print_function
import os
from pathlib import Path
import sys
import io
import time
from pathlib import Path
from collections import deque
from copy import copy
import io

from .utils import read_textfile

Expand Down
4 changes: 2 additions & 2 deletions larch/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
numpy functions are imported if available and used.
"""
import os
from pathlib import Path
import sys
import types
import ast
import math
import numpy
from pathlib import Path
from copy import deepcopy

from . import site_config
Expand Down Expand Up @@ -1071,7 +1071,7 @@ def import_module(self, name, asname=None,
continue
if larchname in sorted(os.listdir(dirname)):
islarch = True
modname = Path(dirname, larchname).absolute()
modname = Path(dirname, larchname).absolute().as_posix()
try:
thismod = self.runfile(modname, new_module=name)
except:
Expand Down
18 changes: 9 additions & 9 deletions larch/larchlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ def add2path(envvar='PATH', dirname='.'):
os.environ[envvar] = dirname
else:
paths = oldpath.split(sep)
paths.insert(0, Path(dirname).absolute())
paths.insert(0, Path(dirname).absolute().as_posix())
os.environ[envvar] = sep.join(paths)
return oldpath

Expand All @@ -378,14 +378,14 @@ def get_dll(libname):
# normally, we expect the dll to be here in the larch dlls tree
# if we find it there, use that one
fname = _dylib_formats[uname] % libname
dllpath = Path(bindir, fname)
if Path(dllpath).exists():
return loaddll(dllpath)
dllpath = Path(bindir, fname).absolute()
if dllpath.exists():
return loaddll(dllpath.as_posix())

# if not found in the larch dlls tree, try your best!
dllpath = ctypes.util.find_library(libname)
if dllpath is not None and Path(dllpath).exists():
return loaddll(dllpath)
dllpath = Path(ctypes.util.find_library(libname)).absolute()
if dllpath is not None and dllpath.exists():
return loaddll(dllpath.as_posix())
return None


Expand All @@ -399,7 +399,7 @@ def read_workdir(conffile):

try:
w_file = Path(user_larchdir, conffile).absolute()
if Path(w_file).exists():
if w_file.exists():
line = open(w_file, 'r').readlines()
workdir = line[0][:-1]
os.chdir(workdir)
Expand Down Expand Up @@ -431,7 +431,7 @@ def read_config(conffile):
"""
cfile = Path(user_larchdir, conffile).absolute()
out = None
if Path(cfile).exists():
if cfile.exists():
data = read_textfile(cfile)
try:
out = toml.loads(data)
Expand Down
Loading

0 comments on commit bddd35c

Please sign in to comment.