Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
349 commits
Select commit Hold shift + click to select a range
58c2cb8
Modify background label
AndrewSazonov Nov 17, 2020
cec38ed
Fix build script
AndrewSazonov Nov 17, 2020
8590fa6
Fixup build scripts
wardsimon Nov 17, 2020
0a98055
Merge remote-tracking branch 'origin/gsas' into gsas
wardsimon Nov 17, 2020
85e3c70
Update for specie work
wardsimon Nov 17, 2020
3ce84de
Recalculate sin(Th)/Lambda
AndrewSazonov Nov 17, 2020
8f07686
Set some experimental parameters
AndrewSazonov Nov 18, 2020
721d300
Fixup some serialization
wardsimon Nov 18, 2020
7f3b9ca
Keep temp.cif file for fitting process
AndrewSazonov Nov 19, 2020
44d6463
Fix sinTh/Lambda for CFML
AndrewSazonov Nov 19, 2020
c2108ed
Keep temp.cif for fitting with CFML
AndrewSazonov Nov 19, 2020
710aba3
Update to new CFML api
AndrewSazonov Nov 20, 2020
efb0372
Tidy up background work
wardsimon Nov 25, 2020
d47bfe9
More background tidying
wardsimon Nov 26, 2020
f12e168
Revert BG changes
wardsimon Nov 26, 2020
8713633
Debugging info for y_calc
AndrewSazonov Nov 26, 2020
77bff2e
Add fitting notebook
wardsimon Nov 27, 2020
e4474af
More fitting work
wardsimon Nov 27, 2020
40de2f0
Add CFML fitting notebook
AndrewSazonov Nov 27, 2020
13ec3f5
Update branches
wardsimon Dec 4, 2020
85802ee
Merge pull request #1 from easyScience/coreSiteWork
wardsimon Dec 4, 2020
3dc75a5
Update sin(theta)/lambda
AndrewSazonov Dec 18, 2020
fda4b28
Example bug fixes
wardsimon Jan 8, 2021
95e4647
disable ubuntu ci
AndrewSazonov Jan 8, 2021
4c44a73
Use new CFML api
AndrewSazonov Jan 11, 2021
5d9e092
Add ubuntu ci
AndrewSazonov Jan 11, 2021
a487203
Make libs repos public
AndrewSazonov Jan 12, 2021
8817888
macOS CI only
AndrewSazonov Jan 12, 2021
8b16852
Temporarily disable libs
AndrewSazonov Jan 12, 2021
830a83e
Remove poetry.lock
AndrewSazonov Jan 12, 2021
e97a552
Try windows CI
AndrewSazonov Jan 12, 2021
877466e
Update RelinkCrysfml
AndrewSazonov Jan 12, 2021
bc82b46
Add linux and macos to CI
AndrewSazonov Jan 12, 2021
3f600ec
Install libgfortran4 on ubuntu
AndrewSazonov Jan 13, 2021
34377f9
Update CFML jupyter notebook example
AndrewSazonov Feb 4, 2021
99113cb
More x-array examples
wardsimon Feb 8, 2021
dfcca61
Add setup and requirements for binder
wardsimon Feb 8, 2021
0b482da
Move to easyCore develop
wardsimon Mar 1, 2021
ba1dd0a
Undo/Redo stack work
wardsimon Mar 2, 2021
75c7095
Initial implementation of get_hkl
AndrewSazonov Mar 12, 2021
3a6a7b7
Set default hkl arrays empty
AndrewSazonov Mar 12, 2021
fca17c7
Rename stack_deco to property_stack_deco
AndrewSazonov Mar 12, 2021
ad70df7
Change cryspy handling
wardsimon Mar 26, 2021
e5b82b7
Merge the interfacing work of Sprint13 (#8)
wardsimon Jun 7, 2021
903cd38
Use 'develop' branch of easyCore
AndrewSazonov Jun 8, 2021
2b12aec
Update pyproject.toml
wardsimon Jun 16, 2021
d2cd6aa
Update pyproject.toml
wardsimon Jul 23, 2021
3300b0d
Update __init__.py
wardsimon Jul 23, 2021
7b0fdc0
Update test.yml
wardsimon Jul 23, 2021
bd53c9b
Update pyproject.toml
wardsimon Jul 26, 2021
479a620
Update GSASII.py
wardsimon Jul 26, 2021
2fd6510
ReflectionList nrefs to nref
AndrewSazonov Jul 27, 2021
4cdd194
Moving to a more module based scheme
wardsimon Jul 30, 2021
456375b
TOF support
wardsimon Aug 9, 2021
073b413
Decouple phases and EXP in cryspy
wardsimon Aug 10, 2021
1f2b9cb
Fix legacy mode loading
wardsimon Aug 10, 2021
236d27d
Use the correct references for legacy mode
AndrewSazonov Aug 10, 2021
695473b
Unification of naming conventions
wardsimon Aug 11, 2021
888ad48
Fix TOF generation
wardsimon Aug 11, 2021
a88eef8
Fix changing from TOF->CW
wardsimon Aug 12, 2021
a61dd37
Fix all interfaces to use new schema
wardsimon Aug 18, 2021
1579521
Update interface and exp_type verification logic
wardsimon Aug 18, 2021
bcf3474
cryspy multiprocess support
wardsimon Aug 19, 2021
b5bb31e
Change mp pool methodology
wardsimon Aug 20, 2021
be81a22
Add scaling parameters for phases
wardsimon Aug 20, 2021
c5a005c
Initial Polarization work
wardsimon Aug 23, 2021
32d85c0
Work on obtaining HKL
wardsimon Aug 24, 2021
28d9177
Fix get HKL
wardsimon Aug 24, 2021
fa52239
Update requirements
wardsimon Aug 24, 2021
ab2100b
Add TOF calculation for cryspy (#10)
wardsimon Aug 24, 2021
3650c46
Delete .devcontainer directory
wardsimon Aug 24, 2021
0cbd66b
Delete tools directory
wardsimon Aug 24, 2021
69d53ac
Tests base and README
wardsimon Aug 25, 2021
419ca5c
Update LICENSE
wardsimon Aug 25, 2021
a972008
Merge branch 'develop' into TOF
rozyczko Sep 8, 2021
bfed583
fixed/updated FittingData notebook
rozyczko Sep 10, 2021
97a36b3
more updates for new eC and eDL
rozyczko Sep 13, 2021
2723296
Disable Lorentzian coefficients
AndrewSazonov Sep 14, 2021
b574699
Added CreateSample notebook, added structure show to existing notebooks.
rozyczko Sep 14, 2021
daf5925
Cleaned up outputs
rozyczko Sep 15, 2021
19b97b8
Temporary workaround to get ADP value
AndrewSazonov Sep 16, 2021
084ceca
easyCore dependence temporarily changed
rozyczko Sep 16, 2021
8838fb5
Minor changes to the notebooks. Updated toml and fixed CFML interface
rozyczko Sep 19, 2021
a0893d4
Separated working notebooks to a different directory.
rozyczko Sep 20, 2021
1fd635a
Temporary workaround to get ADP value (GSASII)
AndrewSazonov Sep 21, 2021
4c89ad2
Fix return value; back to develop branch
AndrewSazonov Sep 21, 2021
87e8beb
Merge branch 'develop' into more_notebooks
rozyczko Sep 27, 2021
207bdd2
Add PbSO4 fitting notebook
AndrewSazonov Sep 27, 2021
b74fa94
Merge branch 'develop' into more_notebooks
wardsimon Sep 27, 2021
759b5fb
Merge branch 'more_notebooks' into release_preparation
wardsimon Sep 27, 2021
eb63de5
Merge branch 'more_notebooks' of https://github.com/easyScience/easyD…
rozyczko Sep 27, 2021
5353dfa
Updated notebooks, corrected dependency for easyCore
rozyczko Sep 27, 2021
4c04e65
Auto stash before merge of "more_notebooks" and "origin/more_notebooks"
wardsimon Sep 27, 2021
76f777a
Disable debug output for CFML
AndrewSazonov Sep 27, 2021
71be218
Use easyCore from the develop branch
AndrewSazonov Sep 27, 2021
4cd03c1
Update fitting notebook
AndrewSazonov Sep 27, 2021
4ef56f0
Move notebooks into 'examples' folder
AndrewSazonov Sep 27, 2021
e7e8dab
Add instruction on how to run Jupyter Notebook examples
AndrewSazonov Sep 27, 2021
1bce0b8
Update fitting example
AndrewSazonov Sep 27, 2021
a3997bf
Merge remote-tracking branch 'origin/more_notebooks' into more_notebooks
AndrewSazonov Sep 27, 2021
5d1ee63
Merge branch 'more_notebooks' into release_preparation
wardsimon Sep 28, 2021
d16ddb3
A bit better README
wardsimon Sep 28, 2021
0fb5947
Add contributing details
wardsimon Sep 28, 2021
513e9ca
Merge branch 'release_preparation' into more_notebooks
wardsimon Sep 28, 2021
3c08040
Start with tests
wardsimon Sep 28, 2021
6a78229
Merge branch 'release_preparation' into more_notebooks
wardsimon Sep 28, 2021
aaf6727
Delete setup.py
wardsimon Sep 28, 2021
febe16c
Update README.md
AndrewSazonov Sep 28, 2021
9133c6d
Update both `simulation` and `fitting` examples
AndrewSazonov Sep 28, 2021
530ca96
Update README.md
AndrewSazonov Sep 28, 2021
17c403f
Delete unused files
AndrewSazonov Sep 28, 2021
015217e
Added modified fix from the mp_mc branch to enable proper phase removal
rozyczko Sep 30, 2021
5e7392f
Merge branch 'phases_fix' into develop
rozyczko Oct 1, 2021
dfa183d
Update both `simulation` and `fitting` examples
AndrewSazonov Sep 28, 2021
0d1d414
Fix up Docs and files
wardsimon Oct 1, 2021
6598952
Update badge
wardsimon Oct 1, 2021
94a0651
Add generators
wardsimon Oct 1, 2021
f754022
Merge branch 'release_preparation' into develop
wardsimon Oct 1, 2021
b6657db
Update self_publish_alpha.yml
wardsimon Oct 1, 2021
fe9338d
Auto stash before merge of "develop" and "origin/develop"
wardsimon Oct 1, 2021
99d4cc0
Update self_publish_alpha.yml
wardsimon Oct 1, 2021
fb0e903
Update generate_html.py
wardsimon Oct 1, 2021
ecce553
Update self_publish_alpha.yml
wardsimon Oct 1, 2021
78ad79c
Update self_publish_alpha.yml
wardsimon Oct 1, 2021
b612523
Update self_publish_alpha.yml
wardsimon Oct 1, 2021
20dad3d
Auto stash before merge of "develop" and "origin/develop"
wardsimon Oct 1, 2021
e884311
Update self_publish_alpha.yml
wardsimon Oct 4, 2021
c55ab0c
Try to create tagged realease
wardsimon Oct 4, 2021
638ddf8
Rename from easyDiffractionLib to easyDiffraction
wardsimon Oct 4, 2021
219881c
Modify project and requirements
wardsimon Oct 4, 2021
5fbc026
Use easysciencecore >= 0.1.1a0
AndrewSazonov Oct 4, 2021
532744c
Only push if changes
wardsimon Oct 4, 2021
fbbbed7
Merge remote-tracking branch 'origin/develop' into develop
wardsimon Oct 4, 2021
51b2e11
Add `v` to tag
wardsimon Oct 4, 2021
f746eea
Update README.md
AndrewSazonov Oct 4, 2021
4f33ee5
Write all packages
wardsimon Oct 4, 2021
e11ad79
Add PR validation (needs labels)
wardsimon Oct 5, 2021
4751083
Add more branch protection stuff
wardsimon Oct 5, 2021
8f5cc14
Add documentation label
wardsimon Oct 5, 2021
56bacd3
Add the ability to launch examples on Binder (#12)
wardsimon Oct 5, 2021
44c3c00
Switch from `matplotlib` to `bokeh` in notebooks
AndrewSazonov Oct 6, 2021
0779668
Update requirements to use `bokeh` instead of `matplotlib`
AndrewSazonov Oct 6, 2021
94d40fb
Add links to non-interactive preview for notebooks
AndrewSazonov Oct 6, 2021
60e68ff
Fix import `easyDiffractionLib`
AndrewSazonov Oct 6, 2021
2471742
Update notebooks
AndrewSazonov Oct 6, 2021
b12a6cc
Update notebook
AndrewSazonov Oct 7, 2021
491bdd9
Update postBuild
wardsimon Oct 11, 2021
bcf107f
Update Simulation.ipynb
wardsimon Oct 11, 2021
3e99825
Update notebooks
wardsimon Oct 11, 2021
792089a
Add patch to autobuild (fix pypi arguments)
wardsimon Oct 11, 2021
966ec09
Create pypi_publish.yml
wardsimon Oct 11, 2021
c8ba665
Modified mp_mc branch with pathos multiprocessing commented out
rozyczko Nov 11, 2021
b7ef004
Merge branch 'develop' into multiphase
rozyczko Nov 11, 2021
be26f02
Added convencience methods for single phase profiles
rozyczko Nov 18, 2021
2644fae
Redefine additional_data['components'] with scaled values
rozyczko Nov 19, 2021
c7a6fc5
typo in toml
rozyczko Nov 20, 2021
d28e7d2
Implement multiphase with CFML
wardsimon Nov 26, 2021
5ff10ac
More CFML multiphase changes
wardsimon Nov 29, 2021
717a759
Fix memory issues again
wardsimon Nov 29, 2021
eefe821
Fix spacegroup errors for multiphase
wardsimon Dec 2, 2021
9d58010
Add support for the multiple HKL sets
AndrewSazonov Dec 10, 2021
ce2c833
x_array is unnecessary for cryspy - hkl has already been calculated in
rozyczko Dec 13, 2021
97a8a31
Fix for getting HKL's
wardsimon Jan 19, 2022
9dfd6b8
Use easyCrystallography
wardsimon Jan 19, 2022
50b8779
Added a multiphase fitting example
rozyczko Jan 19, 2022
41220e6
Merge branch 'multiphase' of https://github.com/easyScience/easyDiffr…
rozyczko Jan 19, 2022
978535e
Merge remote-tracking branch 'origin/easyCrystallography' into releas…
rozyczko Jan 20, 2022
4b0f77a
fix a "typo".
rozyczko Jan 21, 2022
70a478e
fixed method signatures.
rozyczko Jan 26, 2022
654560d
Merge branch 'develop' into release-0.8.3
rozyczko Feb 1, 2022
ee44d4a
Update requirements
rozyczko Feb 1, 2022
da41bb9
Test pre-release branch of easyCore
rozyczko Feb 1, 2022
b6ae64e
Updated copyright year
rozyczko Feb 2, 2022
38b5984
Try to use the release version of easyCore
rozyczko Feb 2, 2022
8b55434
Merge branch 'master' into develop
rozyczko Feb 2, 2022
1eb6726
update poetry
rozyczko Feb 4, 2022
0794742
Fetch easyCrystallography from pypi
rozyczko Feb 4, 2022
7c46415
Remove multiphase temp files on CFML calculator initialize #190 (#36)
rozyczko Mar 16, 2022
312646c
Update pytest requirement from ^5.2 to ^7.1 (#37)
dependabot[bot] Mar 16, 2022
dd97100
Update pyproject.toml (#38)
arm61 Mar 16, 2022
a0b3cf7
Merge branch 'master' into develop
rozyczko Jul 28, 2022
ac7aba8
Updated pypi-publish step (#55)
rozyczko Aug 4, 2022
8099e6e
Merge branch 'master' into develop
rozyczko Aug 8, 2022
7e5c0ca
Implement peak asymmetries for CrysPy P1D (#57)
AndrewSazonov Aug 23, 2022
ec19a19
Experiment cif reader (#58)
rozyczko Nov 14, 2022
ea49820
cherrypicked remaining changes from IOTake2.
rozyczko Nov 14, 2022
1c2272a
More fixes
rozyczko Nov 21, 2022
c06b1d1
Update from_cif_file signature. Added case for xml-fied phase
rozyczko Nov 30, 2022
027ca1c
Added a crutch for updating the background dict repr with the linked
rozyczko Dec 2, 2022
2d7e104
Switch to pre-release-fixes branch of Core
rozyczko Dec 3, 2022
3e6f71c
Bump cfml from 0.0.1 to 0.0.3 (#44)
dependabot[bot] Dec 12, 2022
348cb68
Temporarily lock easyCore version after API breaking changes in 0.3.0.
rozyczko Dec 12, 2022
9266256
Update bokeh requirement from ^2.4.0 to ^3.0.3 (#65)
dependabot[bot] Dec 12, 2022
0021e52
Corrected space group key
rozyczko Dec 12, 2022
56c0b6f
Merge branch 'develop' into IOTake3
rozyczko Dec 12, 2022
f185966
initial version of the pdffit interface. Works for profile calculations.
rozyczko Jan 5, 2023
f3919b6
Added diffpy module dependencies
rozyczko Jan 5, 2023
5545bf0
point to released version of core and cryst
rozyczko Jan 13, 2023
0cebec1
Add fitting example, fixed minor issues
rozyczko Jan 16, 2023
d7fb03c
initial version, not much here yet
rozyczko Jan 17, 2023
2402a1a
move bindings update from sample to job
rozyczko Jan 18, 2023
763d035
return ndarray rather that xarray from fitting
rozyczko Jan 19, 2023
b8f458e
Fixes for serialization of the job object
rozyczko Jan 23, 2023
1e48fd7
set default linked experiment for serialized no-exp loaded cases
rozyczko Jan 24, 2023
95b0b83
Invoke bindings change properly
rozyczko Jan 27, 2023
fdeabe8
Added notebooks for profile calc and fitting
rozyczko Feb 10, 2023
89cd7be
Merge branch 'pdf' into release-0.8.5
rozyczko Feb 13, 2023
a922782
Bump cfml from 0.0.1 to 0.0.3 (#67)
dependabot[bot] Feb 13, 2023
d8595d6
Try getting pdffit2 from local pypi
rozyczko Feb 17, 2023
3bbe934
attempt at fixing dependencies
rozyczko Feb 17, 2023
9f04495
Updates from job_based branch.
rozyczko Feb 20, 2023
4385696
make pdffit2 dependency optional, as gsas/cfml
rozyczko Feb 20, 2023
bf1a9d5
Updated/fixed pdf interface, now conforming to the job based runs.
rozyczko Feb 21, 2023
6634a01
Silence the diffpy backend STDOUT
rozyczko Feb 21, 2023
6fc883b
branch update
rozyczko Feb 21, 2023
970221b
Updated notebooks
rozyczko Feb 23, 2023
64e8186
Update py3dmol requirement from ^1.7.0 to ^2.0.1 (#69)
dependabot[bot] Feb 24, 2023
da1dfc3
dep update
rozyczko Feb 24, 2023
3bec9ba
added delta1, delta2 parameters
rozyczko Feb 26, 2023
c9b346e
Prettified the notebook and the script
rozyczko Feb 27, 2023
7d93858
Rename CrysPyV2 -> CrysPy
rozyczko Feb 27, 2023
5dbd4dc
Update pyproject.toml
wardsimon Mar 1, 2023
51071b9
phase without exp - sim range param update causes errors
rozyczko Mar 2, 2023
974c013
Merge branch 'release-0.8.5' of https://github.com/easyScience/easyDi…
rozyczko Mar 2, 2023
93ce43a
debug weird update issue
rozyczko Mar 7, 2023
445dc05
Workaround for resized coords
rozyczko Mar 8, 2023
fd617fd
Add pdffit dependency so pip install doesn't complain
rozyczko Mar 9, 2023
a76bf85
update requirements.txt
rozyczko Mar 9, 2023
afc8e6f
Minor updates. Moved xarray checks to app.
rozyczko Mar 13, 2023
48a5d7a
Make sure interface bindings are properly set on job instantiation
rozyczko Mar 13, 2023
9788ecb
pdf changes after Celine's comments
rozyczko Mar 14, 2023
b4cc135
add dependency on pycifrw, required by pdffit2
rozyczko Mar 14, 2023
70bbebb
delta1 and delta2 have units
rozyczko Mar 15, 2023
f2d0b02
parameter name should be prettyfied
rozyczko Mar 15, 2023
d882046
check if setting pip config helps with module installation
rozyczko Mar 15, 2023
3932e75
Modify wavelength to correspond to the gr input file.
rozyczko Mar 16, 2023
4ef2bd5
notebook and example script updates
rozyczko Mar 16, 2023
7b43ad6
Added "spdiameter" parameter, as per GSASII examples
rozyczko Mar 16, 2023
192c89a
added spdiameter parameter to the notebook examples
rozyczko Mar 16, 2023
31bd259
update initial values for spdiameter and update the examples
rozyczko Mar 16, 2023
3fbf825
don't update atoms without adp
rozyczko Mar 17, 2023
41eec31
Merge pull request #74 from easyScience/additional_pypi_org
rozyczko Mar 20, 2023
f76c08b
workaround for CFML failures
rozyczko Mar 20, 2023
81a28a5
Bumped release version
rozyczko Mar 21, 2023
5cbc4dd
Merge branch 'develop' into release-0.8.5
rozyczko Mar 23, 2023
d756369
Updated notebooks and added missed method in CryspyV2 interface
rozyczko Mar 24, 2023
763f134
Added minor updates about the current release
rozyczko Mar 27, 2023
c82835b
Merge branch 'release-0.8.5' of https://github.com/easyScience/easyDi…
rozyczko Mar 27, 2023
418777c
Merge pull request #76 from easyScience/release-0.8.5
rozyczko Mar 28, 2023
ca88002
Do not patch the version but take it directly from poetry
rozyczko Mar 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pypi_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ jobs:
run: |
poetry build
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_PASSWORD }}
1 change: 0 additions & 1 deletion .github/workflows/self_publish_alpha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ jobs:
- uses: Gr1N/setup-poetry@v7
- name: Install and build
run: |
poetry version patch
poetry build

- name: Set name variable
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ jobs:
with:
python-version: 3.8

- name: Enable extra repository
shell: bash
run: |
pip config --user set global.extra-index-url https://easyscience.github.io/pypi/
pip config --user set global.trusted-host easyscience.github.io

- name: Some logging
shell: bash
run: |
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@
# Version 0.0.9-beta (28 Mar 2023)

### New Features

- Simulating and fitting Pair Distribution Function data using the [PDFFIT](https://github.com/diffpy/diffpy.pdffit2) calculation engine.

### Changes

- GSASII calculation engine has been removed.
- Changed API to define `Job` object as no longer based on the `Sample` class.
- [Xarray objects](https://github.com/pydata/xarray) are now used to store the calculation engine results.
- Overall performance has been improved.

-

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
**easydiffractionLib** is a Python library which provides:
* Scripting interface to simulate and analyse neutron diffraction patterns.
* Multiple optimization algorithms to minimize models to experimental data: [Lmfit](https://lmfit.github.io/lmfit-py/), [Bumps](https://github.com/bumps/bumps) and [DFO_LS](https://github.com/numericalalgorithmsgroup/dfols).
* Multiple calculation engines: [CrysPy](https://github.com/ikibalin/cryspy), [CrysFML](https://www.ill.eu/sites/fullprof/php/programs24b7.html?pagina=Crysfml), [GSAS-II](https://subversion.xray.aps.anl.gov/trac/pyGSAS).
* Multiple calculation engines: [CrysPy](https://github.com/ikibalin/cryspy), [CrysFML](https://www.ill.eu/sites/fullprof/php/programs24b7.html?pagina=Crysfml).

**easydiffractionLib** is the foundation of [**easyDiffraction**](https://github.com/easyScience/easyDiffraction), an intuitive application which endeavors simplifying and accelerating the analysis of diffraction experiments.

Expand Down
11 changes: 9 additions & 2 deletions easyDiffractionLib/Interfaces/CFML.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,21 @@ def dump_cif(self, *args, **kwargs):
return
# delete preexising cif files
self.remove_cif()
# naive and silly workaround for something mysterious happening in easyCrystallography
content = str(self._phase.cif)
content = content.replace("H-M_ref", "H-M_alt")
with open(self._filename, "w") as fid:
fid.write(str(self._phase.cif))
# fid.write(str(self._phase.cif))
fid.write(content)
base, file = os.path.split(self._filename)
ext = file[-3:]
file = file[:-4]
for idx, phase in enumerate(self._phase):
content = str(phase.cif)
content = content.replace("H-M_ref", "H-M_alt")
with open(f"{os.path.join(base, file)}_{idx}.{ext}", "w") as fid:
fid.write(str(phase.cif))
#fid.write(str(phase.cif))
fid.write(content)

def remove_cif(self):
if self._filename is None:
Expand Down
4 changes: 2 additions & 2 deletions easyDiffractionLib/Interfaces/GSASII.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ def create(self, model):
elif issubclass(t_, Phases):
self._phase = model
elif t_.__name__ in ['Powder1DCW', 'powder1DCW', 'Npowder1DCW', 'Npowder1DCWunp']:
# #TODO Check to see if parameters and pattern should be initialized here.
self.__createModel(model_key, 'powder1DCW')
#TODO Check to see if parameters and pattern should be initialized here.
self.__createModel(model)
elif issubclass(t_, Sample):
self.__createModel(model)
else:
Expand Down
28 changes: 16 additions & 12 deletions easyDiffractionLib/Interfaces/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,34 @@
import traceback


try:
from easyDiffractionLib.Interfaces.cryspy import Cryspy # noqa: F401
except ImportError:
# TODO make this a proper message (use logging?)
print('Warning: CrysPy is not installed')


# try:
# from easyDiffractionLib.Interfaces.cryspyV2 import CryspyBase # noqa: F401
# from easyDiffractionLib.Interfaces.cryspy import Cryspy # noqa: F401
# except ImportError:
# # TODO make this a proper message (use logging?)
# print('Warning: CrysPy is not installed')


try:
from easyDiffractionLib.Interfaces.CFML import CFML # noqa: F401
from easyDiffractionLib.Interfaces.cryspyV2 import CryspyBase # noqa: F401
except ImportError:
# TODO make this a proper message (use logging?)
print('Warning: CrysFML is not installed')
print('Warning: CrysPy is not installed')

try:
from easyDiffractionLib.Interfaces.GSASII import GSASII # noqa: F401
from easyDiffractionLib.Interfaces.CFML import CFML # noqa: F401
except ImportError:
# TODO make this a proper message (use logging?)
print('Warning: GSAS-2 is not installed')
print('Warning: CrysFML is not installed')

# try:
# from easyDiffractionLib.Interfaces.GSASII import GSASII # noqa: F401
# except ImportError:
# # TODO make this a proper message (use logging?)
# print('Warning: GSAS-2 is not installed')

try:
from easyDiffractionLib.Interfaces.pdffit2 import Pdffit2 # noqa: F401
except ImportError:
print('Warning: PdfFit2 is not installed')

from easyDiffractionLib.Interfaces.interfaceTemplate import InterfaceTemplate
29 changes: 24 additions & 5 deletions easyDiffractionLib/Interfaces/cryspy.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,16 @@ class Cryspy(InterfaceTemplate):
"Bani": "b_iso_or_equiv",
}
_instrument_link = {
"wavelength": "wavelength",
"resolution_u": "u",
"resolution_v": "v",
"resolution_w": "w",
"resolution_x": "x",
"resolution_y": "y",
"wavelength": "wavelength",
"reflex_asymmetry_p1": "p1",
"reflex_asymmetry_p2": "p2",
"reflex_asymmetry_p3": "p3",
"reflex_asymmetry_p4": "p4"
}
_polarization_link = {
"polarization": "polarization",
Expand Down Expand Up @@ -106,27 +110,42 @@ def create(self, model):
model_key = self.__identify(model)
if issubclass(t_, Instrument1DCWParameters):
self.calculator.createModel(model_key, "powder1DCW")
# These parameters are linked to the Resolution and Setup cryspy objects

# These parameters are linked to the Resolution, Peak Asymmetry and Setup cryspy objects
res_key = self.calculator.createResolution()
asymm_key = self.calculator.createReflexAsymmetry()
setup_key = self.calculator.createSetup()

keys = self._instrument_link.copy()
keys.pop("wavelength")
res_keys = {k: v for k, v in keys.items() if 'resolution' in k}
asymm_keys = {k: v for k, v in keys.items() if 'reflex_asymmetry' in k}
setup_keys = {k: v for k, v in keys.items() if 'wavelength' in k}

r_list.append(
ItemContainer(
res_key,
keys,
res_keys,
self.calculator.genericReturn,
self.calculator.genericUpdate,
)
)
r_list.append(
ItemContainer(
asymm_key,
asymm_keys,
self.calculator.genericReturn,
self.calculator.genericUpdate,
)
)
r_list.append(
ItemContainer(
setup_key,
{"wavelength": self._instrument_link["wavelength"]},
setup_keys,
self.calculator.genericReturn,
self.calculator.genericUpdate,
)
)

if issubclass(t_, Instrument1DTOFParameters):
self.calculator.createModel(model_key, "powder1DTOF")
# These parameters are linked to the Resolution and Setup cryspy objects
Expand Down
83 changes: 76 additions & 7 deletions easyDiffractionLib/Interfaces/cryspyV2.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def create(self, model: B) -> List[ItemContainer]:
# Interface with Spacegroup
elif issubclass(t_, SpaceGroup):
s_key = self.calculator.createSpaceGroup(key=model_key, name_hm_alt="P 1")
keys = {"_space_group_HM_name": "name_hm_alt"}
keys = {"hermann_mauguin": "name_hm_alt"}
r_list.append(
ItemContainer(
s_key,
Expand Down Expand Up @@ -276,12 +276,16 @@ class CW(CW_type):
"""

_instrument_link = {
"wavelength": "wavelength",
"resolution_u": "u",
"resolution_v": "v",
"resolution_w": "w",
"resolution_x": "x",
"resolution_y": "y",
"wavelength": "wavelength",
"reflex_asymmetry_p1": "p1",
"reflex_asymmetry_p2": "p2",
"reflex_asymmetry_p3": "p3",
"reflex_asymmetry_p4": "p4"
}

def create(self, model: B) -> List[ItemContainer]:
Expand All @@ -292,27 +296,42 @@ def create(self, model: B) -> List[ItemContainer]:
# Link the Instrumental parameters to the calculator.
if issubclass(t_, Instrument1DCWParameters):
self.calculator.createModel(model_key, "powder1DCW")
# These parameters are linked to the Resolution and Setup cryspy objects

# These parameters are linked to the Resolution, Peak Asymmetry and Setup cryspy objects
res_key = self.calculator.createResolution()
asymm_key = self.calculator.createReflexAsymmetry()
setup_key = self.calculator.createSetup()

keys = self._instrument_link.copy()
keys.pop("wavelength")
res_keys = {k: v for k, v in keys.items() if 'resolution' in k}
asymm_keys = {k: v for k, v in keys.items() if 'reflex_asymmetry' in k}
setup_keys = {k: v for k, v in keys.items() if 'wavelength' in k}

r_list.append(
ItemContainer(
res_key,
keys,
res_keys,
self.calculator.genericReturn,
self.calculator.genericUpdate,
)
)
r_list.append(
ItemContainer(
asymm_key,
asymm_keys,
self.calculator.genericReturn,
self.calculator.genericUpdate,
)
)
r_list.append(
ItemContainer(
setup_key,
{"wavelength": self._instrument_link["wavelength"]},
setup_keys,
self.calculator.genericReturn,
self.calculator.genericUpdate,
)
)

return r_list


Expand Down Expand Up @@ -579,6 +598,7 @@ def create(self, model: B) -> List[ItemContainer]:
model_key = self._identify(model)
base = "powder1DCWpol"
if t_.__name__ == "Sample" or t_.__name__ in [
"PolPowder1DCW",
"Powder1DCWpol",
"powder1DCWpol",
"Npowder1DCWpol",
Expand Down Expand Up @@ -625,7 +645,7 @@ def create(self, model: B) -> List[ItemContainer]:
## This is the main class which is called, implementing one of the above classes.
##
class CryspyV2(InterfaceTemplate):
name = "CrysPyV2"
name = "CrysPy"

feature_available = {
"Npowder1DCWunp": True,
Expand Down Expand Up @@ -691,6 +711,36 @@ def fit_func(self, x_array: np.ndarray, *args, **kwargs) -> Union[np.ndarray, No
)
return calculation

def generate_pol_fit_func(
self,
x_array: np.ndarray,
spin_up: np.ndarray,
spin_down: np.ndarray,
components: List[Callable],
) -> Callable:
num_components = len(components)
dummy_x = np.repeat(x_array[..., np.newaxis], num_components, axis=x_array.ndim)
calculated_y = np.array(
[fun(spin_up, spin_down) for fun in components]
).swapaxes(0, x_array.ndim)

def pol_fit_fuction(dummy_x: np.ndarray, **kwargs) -> np.ndarray:
results, results_dict = self.calculator.full_calculate(
x_array, pol_fn=components[0], **kwargs
)
phases = list(results_dict["phases"].keys())[0]
up, down = (
results_dict["phases"][phases]["components"]["up"],
results_dict["phases"][phases]["components"]["down"],
)
bg = results_dict["f_background"]
sim_y = np.array(
[fun(up, down) + fun(bg, bg) for fun in components]
).swapaxes(0, x_array.ndim)
return sim_y.flatten()

return dummy_x.flatten(), calculated_y.flatten(), pol_fit_fuction

def get_hkl(
self,
x_array: np.ndarray = None,
Expand Down Expand Up @@ -720,3 +770,22 @@ def get_phase_components(self, phase_name: str) -> dict:
if self._internal is not None:
data = self._internal.get_phase_components(phase_name)
return data

def full_callback(
self,
x_array: np.ndarray,
pol_fn: Optional[Callable[[np.ndarray, np.ndarray], np.ndarray]] = None,
**kwargs,
) -> np.ndarray:
"""
Calculate the polarization components.
:param x_array: points to be calculated at
:return: calculated points
"""
if pol_fn is None:
pol_fn = self.up_plus_down
result = None
if self.calculator is not None:
result = self.calculator.full_calculate(x_array, pol_fn=pol_fn, **kwargs)
return result

4 changes: 2 additions & 2 deletions easyDiffractionLib/Interfaces/interfaceTemplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from abc import ABCMeta, abstractmethod
from typing import Tuple, List
from easyCore import np, borg
from easyCore.Utils.json import MSONable
from easyCore.Objects.core import ComponentSerializer

exp_type_strings = {
'radiation_options': ['N', 'X'],
Expand All @@ -15,7 +15,7 @@
}


class InterfaceTemplate(MSONable, metaclass=ABCMeta):
class InterfaceTemplate(ComponentSerializer, metaclass=ABCMeta):
"""
This class is a template and defines all properties that an interface should have.
"""
Expand Down
Loading