Skip to content

Commit cb158d5

Browse files
authored
Merge pull request #29 from dnjohnstone/v0.10.0
V0.10.0
2 parents ff3c33e + ee15ea7 commit cb158d5

8 files changed

+2320
-48
lines changed

01 GaAs Nanowire - Data Inspection - Preprocessing - Unsupervised Machine Learning.ipynb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"cell_type": "markdown",
2626
"metadata": {},
2727
"source": [
28-
"This functionaility has been checked to run in pyxem-0.9.0 (July 2019). Bugs are always possible, do not trust the code blindly, and if you experience any issues please report them here: https://github.com/pyxem/pyxem-demos/issues"
28+
"This functionaility has been checked to run in pyxem-0.10.0 (November 2019). Bugs are always possible, do not trust the code blindly, and if you experience any issues please report them here: https://github.com/pyxem/pyxem-demos/issues"
2929
]
3030
},
3131
{
@@ -246,7 +246,8 @@
246246
"metadata": {},
247247
"outputs": [],
248248
"source": [
249-
"dp.center_direct_beam(radius_start=2,\n",
249+
"dp.center_direct_beam(method='cross_correlate',\n",
250+
" radius_start=2,\n",
250251
" radius_finish=5,\n",
251252
" square_width=10)"
252253
]

02 GaAs Nanowire - Phase Mapping - Orientation Mapping.ipynb

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"cell_type": "markdown",
2626
"metadata": {},
2727
"source": [
28-
"This functionaility has been checked to run in pyxem-0.9.0 (July 2019). Bugs are always possible, do not trust the code blindly, and if you experience any issues please report them here: https://github.com/pyxem/pyxem-demos/issues"
28+
"This functionaility has been checked to run in pyxem-0.10.0 (November 2019). Bugs are always possible, do not trust the code blindly, and if you experience any issues please report them here: https://github.com/pyxem/pyxem-demos/issues"
2929
]
3030
},
3131
{
@@ -302,9 +302,10 @@
302302
"metadata": {},
303303
"outputs": [],
304304
"source": [
305-
"from diffsims.generators.structure_library_generator import StructureLibraryGenerator\n",
305+
"from diffsims.libraries.structure_library import StructureLibrary\n",
306306
"from diffsims.generators.diffraction_generator import DiffractionGenerator\n",
307307
"from diffsims.generators.library_generator import DiffractionLibraryGenerator\n",
308+
"from diffsims.utils.sim_utils import rotation_list_stereographic\n",
308309
"\n",
309310
"from pyxem.generators.indexation_generator import IndexationGenerator"
310311
]
@@ -330,18 +331,14 @@
330331
"outputs": [],
331332
"source": [
332333
"structure_zb = diffpy.structure.loadStructure('./GaAs_mp-2534_conventional_standard.cif')\n",
333-
"structure_wz = diffpy.structure.loadStructure('./GaAs_mp-8883_conventional_standard.cif')\n",
334-
"\n",
335-
"phase_descriptions = [('ZB', structure_zb, 'cubic'),\n",
336-
" ('WZ', structure_wz, 'hexagonal')]\n",
337-
"phase_names = [phase[0] for phase in phase_descriptions]"
334+
"structure_wz = diffpy.structure.loadStructure('./GaAs_mp-8883_conventional_standard.cif')"
338335
]
339336
},
340337
{
341338
"cell_type": "markdown",
342339
"metadata": {},
343340
"source": [
344-
"Initialize a structure library generator for the specified phases"
341+
"Create a basic rotations list. "
345342
]
346343
},
347344
{
@@ -350,7 +347,8 @@
350347
"metadata": {},
351348
"outputs": [],
352349
"source": [
353-
"struc_lib_gen = StructureLibraryGenerator(phase_descriptions)"
350+
"rot_list_cubic = rotation_list_stereographic(structure_zb,(0, 0, 1),(1, 0, 1),(1, 1, 1),np.linspace(0, 2*np.pi, 360/10),np.deg2rad(10))\n",
351+
"rot_list_hex = rotation_list_stereographic(structure_wz,(0, 0, 0, 1), (1, 0, -1, 0), (1, 1, -2, 0),np.linspace(0, 2*np.pi, 360/10),np.deg2rad(10))"
354352
]
355353
},
356354
{
@@ -366,11 +364,9 @@
366364
"metadata": {},
367365
"outputs": [],
368366
"source": [
369-
"inplane_rotations = [[0], [0]] # The library only needs the base in-plane rotation. The other ones are generated\n",
370-
"rotation_list_resolution = 1\n",
371-
"\n",
372-
"struc_lib = struc_lib_gen.get_orientations_from_stereographic_triangle(\n",
373-
" inplane_rotations, rotation_list_resolution)"
367+
"struc_lib = StructureLibrary(['ZB','WZ'],\n",
368+
" [structure_zb,structure_wz],\n",
369+
" [rot_list_cubic,rot_list_hex])"
374370
]
375371
},
376372
{
@@ -450,7 +446,7 @@
450446
"metadata": {},
451447
"outputs": [],
452448
"source": [
453-
"diff_lib.pickle_library('./GaAs_cubic_hex_1deg.pickle')"
449+
"diff_lib.pickle_library('./GaAs_cubic_hex.pickle')"
454450
]
455451
},
456452
{
@@ -468,7 +464,7 @@
468464
"source": [
469465
"from diffsims.libraries.diffraction_library import load_DiffractionLibrary\n",
470466
"\n",
471-
"diff_lib = load_DiffractionLibrary('./GaAs_cubic_hex_1deg.pickle', safety=True)"
467+
"diff_lib = load_DiffractionLibrary('./GaAs_cubic_hex.pickle', safety=True)"
472468
]
473469
},
474470
{
@@ -948,20 +944,6 @@
948944
"source": [
949945
"crystal_map.save_mtex_map('vector_match_results.csv')"
950946
]
951-
},
952-
{
953-
"cell_type": "code",
954-
"execution_count": null,
955-
"metadata": {},
956-
"outputs": [],
957-
"source": []
958-
},
959-
{
960-
"cell_type": "code",
961-
"execution_count": null,
962-
"metadata": {},
963-
"outputs": [],
964-
"source": []
965947
}
966948
],
967949
"metadata": {
@@ -980,7 +962,7 @@
980962
"name": "python",
981963
"nbconvert_exporter": "python",
982964
"pygments_lexer": "ipython3",
983-
"version": "3.7.1"
965+
"version": "3.7.3"
984966
}
985967
},
986968
"nbformat": 4,

03 Reference Standards - Dimension Calibrations - Rotation Calibrations.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"cell_type": "markdown",
1919
"metadata": {},
2020
"source": [
21-
"This functionaility was introduced in pyxem-0.9.0 (July 2019) and has been checked to run. Bugs are always possible, do not trust the code blindly, and if you experience any issues please report them here: https://github.com/pyxem/pyxem-demos/issues"
21+
"This functionaility has been checked to run in pyxem-0.10.0 (November 2019). Bugs are always possible, do not trust the code blindly, and if you experience any issues please report them here: https://github.com/pyxem/pyxem-demos/issues"
2222
]
2323
},
2424
{

04 Simulate Data - Phase Mapping - Orientation Mapping.ipynb

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"cell_type": "markdown",
2626
"metadata": {},
2727
"source": [
28-
"This functionaility has been checked to run in pyxem-0.9.0 (July 2019). Bugs are always possible, do not trust the code blindly, and if you experience any issues please report them here: https://github.com/pyxem/pyxem-demos/issues"
28+
"This functionaility has been checked to run in pyxem-0.10.0 (November 2019). Bugs are always possible, do not trust the code blindly, and if you experience any issues please report them here: https://github.com/pyxem/pyxem-demos/issues"
2929
]
3030
},
3131
{
@@ -65,14 +65,14 @@
6565
"metadata": {},
6666
"outputs": [],
6767
"source": [
68-
"%matplotlib tk\n",
68+
"%matplotlib qt\n",
6969
"import numpy as np\n",
7070
"import hyperspy.api as hs\n",
7171
"import pyxem as pxm\n",
7272
"import diffpy.structure\n",
7373
"from matplotlib import pyplot as plt\n",
7474
"\n",
75-
"from diffsims.generators.structure_library_generator import StructureLibraryGenerator\n",
75+
"from diffsims.utils.sim_utils import rotation_list_stereographic\n",
7676
"from diffsims.libraries.structure_library import StructureLibrary\n",
7777
"from diffsims.generators.diffraction_generator import DiffractionGenerator\n",
7878
"from diffsims.generators.library_generator import DiffractionLibraryGenerator, VectorLibraryGenerator\n",
@@ -222,12 +222,19 @@
222222
"metadata": {},
223223
"outputs": [],
224224
"source": [
225-
"structure_library_generator = StructureLibraryGenerator(\n",
226-
" [('Si', si, 'cubic'),\n",
227-
" ('Ga', ga, 'hexagonal')])\n",
228-
"structure_library = structure_library_generator.get_orientations_from_stereographic_triangle(\n",
229-
" [(0,), (0,)], # In-plane rotations\n",
230-
" 5) # Angular resolution of the library"
225+
"rot_list_cubic = rotation_list_stereographic(si,(0, 0, 1),(1, 0, 1),(1, 1, 1),np.linspace(0, 2*np.pi, 360/10),np.deg2rad(10))\n",
226+
"rot_list_hex = rotation_list_stereographic(ga,(0, 0, 0, 1), (1, 0, -1, 0), (1, 1, -2, 0),np.linspace(0, 2*np.pi, 50),np.deg2rad(3))"
227+
]
228+
},
229+
{
230+
"cell_type": "code",
231+
"execution_count": null,
232+
"metadata": {},
233+
"outputs": [],
234+
"source": [
235+
"structure_library = StructureLibrary(['si','ga'],\n",
236+
" [si,ga],\n",
237+
" [rot_list_cubic,rot_list_hex])"
231238
]
232239
},
233240
{
@@ -255,7 +262,7 @@
255262
"cell_type": "markdown",
256263
"metadata": {},
257264
"source": [
258-
"Correlate with the patterns contained in the library with the test data. At this stage the top 3 (`n_largest`) matching results are retained. Test all in-plane rotations at 5 degree increments from 0 to 360."
265+
"Correlate with the patterns contained in the library with the test data. At this stage the top 3 (`n_largest`) matching results are retained."
259266
]
260267
},
261268
{
@@ -265,7 +272,7 @@
265272
"outputs": [],
266273
"source": [
267274
"indexer = IndexationGenerator(test_data, template_library)\n",
268-
"match_results = indexer.correlate(n_largest=3, inplane_rotations=np.arange(0, 360, 5))"
275+
"match_results = indexer.correlate(n_largest=3)"
269276
]
270277
},
271278
{

05 Simulate Data - Strain Mapping.ipynb

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"cell_type": "markdown",
2626
"metadata": {},
2727
"source": [
28-
"All functionality has been checked to run using pyxem-0.9.0"
28+
"This functionaility has been checked to run in pyxem-0.10.0 (November 2019). Bugs are always possible, do not trust the code blindly, and if you experience any issues please report them here: https://github.com/pyxem/pyxem-demos/issues"
2929
]
3030
},
3131
{
@@ -351,8 +351,8 @@
351351
"metadata": {},
352352
"outputs": [],
353353
"source": [
354-
"spg = SubpixelrefinementGenerator(dp,np.asarray([x_peak,y_peak]))\n",
355-
"Vs = spg.center_of_mass_method(6)"
354+
"spg = SubpixelrefinementGenerator(dp, np.asarray([x_peak,y_peak]))\n",
355+
"Vs = spg.center_of_mass_method(20)"
356356
]
357357
},
358358
{
@@ -388,6 +388,13 @@
388388
"source": [
389389
"strain_map.plot(cmap='seismic',vmax=0.04,vmin=-0.04)"
390390
]
391+
},
392+
{
393+
"cell_type": "code",
394+
"execution_count": null,
395+
"metadata": {},
396+
"outputs": [],
397+
"source": []
391398
}
392399
],
393400
"metadata": {

0 commit comments

Comments
 (0)