Skip to content

Commit

Permalink
Merge branch 'FABLE-3DXRD:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
jadball authored Dec 13, 2024
2 parents 8cc5f3c + 7a72fc6 commit a0908cb
Show file tree
Hide file tree
Showing 9 changed files with 253 additions and 477 deletions.
39 changes: 39 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Read the Docs configuration file for Sphinx projects
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.11"
# You can also specify other tool versions:
# nodejs: "20"
# rust: "1.70"
# golang: "1.20"
jobs:
post_install:
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH python setup.py build_ext --inplace
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH python -m sphinx.ext.apidoc -o docs/sphx ImageD11

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/sphx/conf.py
# You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs
# builder: "dirhtml"
# Fail on all warnings to avoid broken references
# fail_on_warning: true

# Optionally build your docs in additional formats such as PDF and ePub
# formats:
# - pdf
# - epub

# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: docs/sphx/requirements.txt
36 changes: 29 additions & 7 deletions ImageD11/sinograms/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,22 @@ def __init__(
self._pk2d = None
self._pk4d = None

self.dsfile = None

# paths for processed data
self.analysispath = None # default
# Loaded
if filename is not None:
self.dsfile = filename
self.load(filename)
# paths for processed data

self.analysispath = analysispath
# Supplied overwrites
if analysispath is not None:
# Can be loaded with the dataset
self.analysispath = analysispath

self.update_paths()

def update_paths(self, force=False):
def update_paths(self, force=False, verbose = False):
# paths for processed data
# root of analysis for this dataset for this sample:
self.analysispath_default = os.path.join(
Expand All @@ -161,7 +168,8 @@ def update_paths(self, force=False):
)
# at the moment, set self.dsfile to be the default
# if save or load is ever called, this will be replaced
self.dsfile = self.dsfile_default
if self.dsfile is None:
self.dsfile = self.dsfile_default
# They should be saved / loaded with the dataset.
for name, extn in [
("pksfile", "_peaks_table.h5"),
Expand All @@ -181,6 +189,11 @@ def update_paths(self, force=False):
if (getattr(self, name, None) is None) or force:
# Otherwise, these are the defaults.
setattr(self, name, os.path.join(self.analysispath, self.dsname + extn))
if verbose:
print('updated', getattr( self, name, None ) )
else:
if verbose:
print('not updated', getattr( self, name, None ) )

def __repr__(self):
r = []
Expand Down Expand Up @@ -802,6 +815,9 @@ def check_sparse(self):

def save(self, h5name=None, h5group="/"):
if h5name is None:
if os.path.exists( self.dsfile ):
h5name = self.dsfile

# none supplied, so use default path
h5name = self.dsfile_default
# make sure parent directories exist
Expand Down Expand Up @@ -858,9 +874,15 @@ def save(self, h5name=None, h5group="/"):
self.dsfile = h5name

def load(self, h5name=None, h5group="/"):

if h5name is None:
# none supplied, so use default path
h5name = self.dsfile_default
if os.path.exists( self.dsfile ):
h5name = self.dsfile
elif os.path.exists( self.dsfile_default ):
# none supplied, so use default path
h5name = self.dsfile_default
else:
raise Exception( "Filename for dataset not found")

""" Recover this from a hdf5 file """
with h5py.File(h5name, "r") as hin:
Expand Down
2 changes: 2 additions & 0 deletions ImageD11/sym_u.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ def rhombohedralP():
""" R3 primitive """
return generate_group("z,x,y", "-z,-y,-x")

trigonalP = rhombohedralP

def tetragonal():
""" P4 75"""
return generate_group ( "-y,x,z", "-x,y,-z" )
Expand Down
Loading

0 comments on commit a0908cb

Please sign in to comment.