Skip to content

Commit a3bf7c6

Browse files
committed
Synchronized with the source at 501eef3.
1 parent 8fdb319 commit a3bf7c6

33 files changed

+672
-86
lines changed

NSFnugget.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
<li><a href="products/pdfgetx3.html">PDFgetX3</a></li>
8282
<li><a href="products/pdfgui.html">PDFgui</a></li>
8383
<li><a href="products/SrMise.html">SrMise</a></li>
84+
<li><a href="products/magPDF.html">magPDF</a></li>
8485
<li><a href="products/pythonpackages.html">Python Packages</a></li>
8586
</ul>
8687
</li>

_images/magpdf_screenshot.png

470 KB
Loading

_sources/index.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,4 @@ centered at Columbia University and, before that, Michigan State University.
8282
products/pdfgetx3
8383
products/pythonpackages
8484
products/SrMise
85+
products/magPDF

_sources/products/magPDF.txt

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
##########
2+
magPDF
3+
##########
4+
5+
The diffpy.magpdf package provides a convenient method for computing the magnetic PDF
6+
(mPDF) from magnetic structures and performing fits to neutron total scattering
7+
data. The mPDF is calculated by an mPDFcalculator object, which extracts the spin
8+
positions and spin vectors from a magStructure object that the mPDFcalculator
9+
takes as input. The magStructure object in turn can contain multiple magSpecies
10+
objects, which generate magnetic configurations based on a diffpy.Structure object
11+
and a set of propagation vectors and basis vectors provided by the user.
12+
Alternatively, the user can manually define a magnetic unit cell that will be used
13+
to generate the magnetic structure, or the magnetic structure can be defined simply
14+
as lists of spin positions and spin vectors provided by the user.
15+
16+
17+
18+
.. figure:: ../images/magpdf_screenshot.png
19+
:align: center
20+
21+
This is an early release of magPDF, and the capabilities and documentation of the
22+
project will evolve. The DiffPy team encourages investigators to provide feedback,
23+
suggestions, and feature requests.
24+
25+
26+
Getting Started
27+
=================
28+
29+
The diffpy.magpdf package requires Python 2.6 or 2.7 and the following software:
30+
31+
* ``NumPy`` - numerical mathematics and fast array operations for Python
32+
* ``SciPy`` - scientific libraries for Python
33+
* ``matplotlib`` - python plotting library
34+
* ``diffpy.Structure`` - diffpy package for generating atomic structure
35+
* ``diffpy.srreal`` - diffpy package for calculating real-space quantities
36+
37+
See the :doc:`magPDF license <magPDFlicense>` for terms and conditions of use.
38+
39+
Installation
40+
------------
41+
42+
The recommended way to install this package is through conda. For help installing conda,
43+
please visit `https://www.continuum.io/downloads <https://www.continuum.io/downloads>`__.
44+
Once conda is installed, you can follow the simple steps below to install diffpy.magpdf.
45+
You will also install the full diffpy-cmi suite along the way.
46+
47+
*Step 1: Add the appropriate conda channels to your conda configuration.* ::
48+
49+
conda config --add channels diffpy
50+
conda config --add channels benfrandsen
51+
52+
These commands tell conda to look through these channels on the Anaconda cloud server to
53+
find the appropriate software.
54+
55+
*Step 2 (recommended): Create and activate a conda environment for diffpy + diffpy.magpdf.* ::
56+
57+
conda create --name diffpy python=2.7
58+
source activate diffpy
59+
60+
Note that you can name the environment anything you choose by passing it a different name
61+
after the --name flag in the first command.
62+
63+
*Step 3: Install diffpy.magpdf.* ::
64+
65+
conda install diffpy.magpdf
66+
67+
Note that this will also install the full diffpy-cmi suite if it has not already been
68+
installed in this environment.
69+
70+
*Alternative option: Install from the python package index.*
71+
72+
If you prefer to use the python package index and have pip installed, please install the
73+
prerequisite software and then use the command ::
74+
75+
pip install diffpy.magpdf
76+
77+
*Alternative option: Download and install from source.*
78+
79+
If you prefer to install from source, you can also zip and download the entire package
80+
from `PyPI <https://pypi.python.org/pypi/diffpy.magpdf>`__ or
81+
`GitHub <https://github.com/benfrandsen/diffpy.magpdf>`__, then unzip the file and
82+
execute the following command from inside the unzipped directory ::
83+
84+
python setup.py install
85+
86+
Note that this will only work if all the dependencies are already properly installed.
87+
88+
Documentation
89+
-------------
90+
Please see `http://pythonhosted.org/diffpy.magpdf/ <http://pythonhosted.org/diffpy.magpdf/>`__
91+
for the documentation.
92+
93+
What next?
94+
============
95+
96+
Explore the magPDF tutorial and examples on the
97+
`CMI Exchange <https://github.com/diffpy/cmi_exchange>`_!
98+
99+
.. toctree::
100+
:hidden:
101+
102+
magPDFlicense
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.. this page only contains the LICENSE text for magPDF
2+
3+
.. include:: magPDF_LICENSE.txt
4+
:literal:

_sources/products/pythonpackages.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ Python Packages
33

44
This is a complete list of all Python packages developed by the DiffPy
55
team. For more information about a specific package, follow the link to
6-
the corresponding github page. With the exception of PDFfit2 and SrMise
7-
all of the packages listed below are bundled in the |DiffPyCMI| release.
6+
the corresponding github page. With the exception of PDFfit2, SrMise,
7+
and magPDF, all of the packages listed below are bundled in the |DiffPyCMI|
8+
release.
89

910
====================== ============================================
1011
Module Description
@@ -33,6 +34,9 @@ Module Description
3334
`diffpy.pdffit2`_ Atomic structure refinement and PDF fitting
3435
(this is the computational engine used by
3536
PDFgui).
37+
38+
`diffpy.magpdf`_ Tools for calculating and refining magnetic
39+
PDFs.
3640
====================== ============================================
3741

3842
.. _diffpy.srfit: https://github.com/diffpy/diffpy.srfit
@@ -49,4 +53,6 @@ Module Description
4953

5054
.. _diffpy.pdffit2: https://github.com/diffpy/diffpy.pdffit2
5155

56+
.. _diffpy.magpdf: https://github.com/benfrandsen/diffpy.magpdf
57+
5258
.. include:: ../abbreviations.txt

_static/basic.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Sphinx stylesheet -- basic theme.
66
*
7-
* :copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
7+
* :copyright: Copyright 2007-2015 by the Sphinx team, see AUTHORS.
88
* :license: BSD, see LICENSE for details.
99
*
1010
*/

_static/doctools.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Sphinx JavaScript utilities for all documentation.
66
*
7-
* :copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
7+
* :copyright: Copyright 2007-2015 by the Sphinx team, see AUTHORS.
88
* :license: BSD, see LICENSE for details.
99
*
1010
*/

_static/pygments.css

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44
.highlight .err { border: 1px solid #FF0000 } /* Error */
55
.highlight .k { color: #007020; font-weight: bold } /* Keyword */
66
.highlight .o { color: #666666 } /* Operator */
7-
.highlight .ch { color: #408090; font-style: italic } /* Comment.Hashbang */
87
.highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */
98
.highlight .cp { color: #007020 } /* Comment.Preproc */
10-
.highlight .cpf { color: #408090; font-style: italic } /* Comment.PreprocFile */
119
.highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */
1210
.highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */
1311
.highlight .gd { color: #A00000 } /* Generic.Deleted */

_static/searchtools.js

Lines changed: 9 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
*
55
* Sphinx JavaScript utilties for the full-text search.
66
*
7-
* :copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
7+
* :copyright: Copyright 2007-2015 by the Sphinx team, see AUTHORS.
88
* :license: BSD, see LICENSE for details.
99
*
1010
*/
1111

1212

13-
/* Non-minified version JS is _stemmer.js if file is provided */
1413
/**
1514
* Porter Stemmer
1615
*/
@@ -374,7 +373,8 @@ var Search = {
374373
}
375374

376375
// lookup as search terms in fulltext
377-
results = results.concat(this.performTermsSearch(searchterms, excluded, terms, titleterms));
376+
results = results.concat(this.performTermsSearch(searchterms, excluded, terms, Scorer.term))
377+
.concat(this.performTermsSearch(searchterms, excluded, titleterms, Scorer.title));
378378

379379
// let the scorer override scores with a custom scoring function
380380
if (Scorer.score) {
@@ -538,47 +538,23 @@ var Search = {
538538
/**
539539
* search for full-text terms in the index
540540
*/
541-
performTermsSearch : function(searchterms, excluded, terms, titleterms) {
541+
performTermsSearch : function(searchterms, excluded, terms, score) {
542542
var filenames = this._index.filenames;
543543
var titles = this._index.titles;
544544

545-
var i, j, file;
545+
var i, j, file, files;
546546
var fileMap = {};
547-
var scoreMap = {};
548547
var results = [];
549548

550549
// perform the search on the required terms
551550
for (i = 0; i < searchterms.length; i++) {
552551
var word = searchterms[i];
553-
var files = [];
554-
var _o = [
555-
{files: terms[word], score: Scorer.term},
556-
{files: titleterms[word], score: Scorer.title}
557-
];
558-
559552
// no match but word was a required one
560-
if ($u.every(_o, function(o){return o.files === undefined;})) {
553+
if ((files = terms[word]) === undefined)
561554
break;
555+
if (files.length === undefined) {
556+
files = [files];
562557
}
563-
// found search word in contents
564-
$u.each(_o, function(o) {
565-
var _files = o.files;
566-
if (_files === undefined)
567-
return
568-
569-
if (_files.length === undefined)
570-
_files = [_files];
571-
files = files.concat(_files);
572-
573-
// set score for the word in each file to Scorer.term
574-
for (j = 0; j < _files.length; j++) {
575-
file = _files[j];
576-
if (!(file in scoreMap))
577-
scoreMap[file] = {}
578-
scoreMap[file][word] = o.score;
579-
}
580-
});
581-
582558
// create the mapping
583559
for (j = 0; j < files.length; j++) {
584560
file = files[j];
@@ -600,19 +576,14 @@ var Search = {
600576
// ensure that none of the excluded terms is in the search result
601577
for (i = 0; i < excluded.length; i++) {
602578
if (terms[excluded[i]] == file ||
603-
titleterms[excluded[i]] == file ||
604-
$u.contains(terms[excluded[i]] || [], file) ||
605-
$u.contains(titleterms[excluded[i]] || [], file)) {
579+
$u.contains(terms[excluded[i]] || [], file)) {
606580
valid = false;
607581
break;
608582
}
609583
}
610584

611585
// if we have still a valid result we can add it to the result list
612586
if (valid) {
613-
// select one (max) score for the file.
614-
// for better ranking, we should calculate ranking by using words statistics like basic tf-idf...
615-
var score = $u.max($u.map(fileMap[file], function(w){return scoreMap[file][w]}));
616587
results.push([filenames[file], titles[file], '', null, score]);
617588
}
618589
}

0 commit comments

Comments
 (0)