diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index ab12237c17aac36f51a6d7bba31a1b4179a64a0b..94c0305e3243b7c6f18ed96bef7351a158bbfbb6 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -4,9 +4,17 @@ <inspection_tool class="LongLine" enabled="true" level="WARNING" enabled_by_default="true"> <scope name="*.c" level="WARNING" enabled="false" /> </inspection_tool> + <inspection_tool class="PyArgumentListInspection" enabled="true" level="WARNING" enabled_by_default="true"> + <scope name="gui" level="WARNING" enabled="false" /> + </inspection_tool> <inspection_tool class="PyAttributeOutsideInitInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" /> <inspection_tool class="PyBroadExceptionInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" /> - <inspection_tool class="PyClassicStyleClassInspection" enabled="true" level="WARNING" enabled_by_default="true" /> + <inspection_tool class="PyCallByClassInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true"> + <scope name="gui" level="WEAK WARNING" enabled="false" /> + </inspection_tool> + <inspection_tool class="PyClassicStyleClassInspection" enabled="true" level="WARNING" enabled_by_default="true"> + <scope name="gui" level="WARNING" enabled="false" /> + </inspection_tool> <inspection_tool class="PyCompatibilityInspection" enabled="true" level="WARNING" enabled_by_default="true"> <option name="ourVersions"> <value> @@ -17,8 +25,27 @@ </option> </inspection_tool> <inspection_tool class="PyMandatoryEncodingInspection" enabled="true" level="WARNING" enabled_by_default="true" /> - <inspection_tool class="PyMissingOrEmptyDocstringInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" /> + <inspection_tool class="PyMissingOrEmptyDocstringInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true"> + <scope name="gui" level="WEAK WARNING" enabled="false" /> + </inspection_tool> <inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true"> + <scope name="gui" level="WARNING" enabled="false"> + <option name="ignoredPackages"> + <value> + <list size="0" /> + </value> + </option> + </scope> + <scope name="scripts" level="WARNING" enabled="true"> + <option name="ignoredPackages"> + <value> + <list size="2"> + <item index="0" class="java.lang.String" itemvalue="pylab" /> + <item index="1" class="java.lang.String" itemvalue="tqdm" /> + </list> + </value> + </option> + </scope> <option name="ignoredPackages"> <value> <list size="1"> diff --git a/.idea/workspace.xml b/.idea/workspace.xml index b51248b2b138b2128f9945faa10de663c48408f6..50f66b1e1b18d1933049f44218840883a7fe081a 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -5,8 +5,10 @@ <option name="ANALYSIS_IN_BACKGROUND" value="true" /> </component> <component name="ChangeListManager"> - <list default="true" id="990252ab-aff5-4ac2-a857-b193d2c46b18" name="Default" comment="Refactoring: Replaced MagData with VectorData and added ScalarData class (and common superclass FieldData). magnitude is now called field (which is more appropriate) projector now uses FieldData to process both vector and scalar data (foundation was in place before)"> + <list default="true" id="990252ab-aff5-4ac2-a857-b193d2c46b18" name="Default" comment="Updated long overdue scripts to work with new layout and refactoring!"> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" /> + <change type="MODIFICATION" beforePath="$PROJECT_DIR$/pyramid/kernel.py" afterPath="$PROJECT_DIR$/pyramid/kernel.py" /> + <change type="MODIFICATION" beforePath="$PROJECT_DIR$/../Script-Vault/scripts - Alt/test methods/compare_pixel_fields.py" afterPath="$PROJECT_DIR$/../Script-Vault/scripts - Alt/test methods/compare_pixel_fields.py" /> </list> <ignored path="Pyramid.iws" /> <ignored path=".idea/workspace.xml" /> @@ -31,11 +33,161 @@ </component> <component name="FileEditorManager"> <leaf SIDE_TABS_SIZE_LIMIT_KEY="300"> - <file leaf-file-name="colormap.py" pinned="false" current-in-tab="true"> - <entry file="file://$PROJECT_DIR$/pyramid/colormap.py"> + <file leaf-file-name="example_joern.py" pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/../Script-Vault/scripts - Alt/collaborations/example_joern.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.11171366"> - <caret line="89" column="28" selection-start-line="89" selection-start-column="26" selection-end-line="89" selection-end-column="28" /> + <state vertical-scroll-proportion="0.0"> + <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> + <folding /> + </state> + </provider> + </entry> + </file> + <file leaf-file-name="patrick_nanowire_reconstruction.py" pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/../Script-Vault/scripts - Alt/collaborations/patrick_nanowire_reconstruction.py"> + <provider selected="true" editor-type-id="text-editor"> + <state vertical-scroll-proportion="0.0"> + <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> + <folding /> + </state> + </provider> + </entry> + </file> + <file leaf-file-name="patrick_nanowire_reconstruction_simulation.py" pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/../Script-Vault/scripts - Alt/collaborations/patrick_nanowire_reconstruction_simulation.py"> + <provider selected="true" editor-type-id="text-editor"> + <state vertical-scroll-proportion="0.0"> + <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> + <folding /> + </state> + </provider> + </entry> + </file> + <file leaf-file-name="result.pickle" pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/../Script-Vault/scripts - Alt/collaborations/result.pickle"> + <provider selected="true" editor-type-id="text-editor"> + <state vertical-scroll-proportion="0.0"> + <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> + <folding /> + </state> + </provider> + </entry> + </file> + <file leaf-file-name="rueffner_file.py" pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/../Script-Vault/scripts - Alt/collaborations/rueffner_file.py"> + <provider selected="true" editor-type-id="text-editor"> + <state vertical-scroll-proportion="0.0"> + <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> + <folding /> + </state> + </provider> + </entry> + </file> + <file leaf-file-name="vtk_conversion_nanowire_full.py" pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/../Script-Vault/scripts - Alt/collaborations/vtk_conversion_nanowire_full.py"> + <provider selected="true" editor-type-id="text-editor"> + <state vertical-scroll-proportion="0.0"> + <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> + <folding /> + </state> + </provider> + </entry> + </file> + <file leaf-file-name="reconstruct_random_pixels.py" pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/../Script-Vault/scripts - Alt/reconstruction/reconstruct_random_pixels.py"> + <provider selected="true" editor-type-id="text-editor"> + <state vertical-scroll-proportion="0.0"> + <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> + <folding /> + </state> + </provider> + </entry> + </file> + <file leaf-file-name="reconstruction_linear_test.py" pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/../Script-Vault/scripts - Alt/reconstruction/reconstruction_linear_test.py"> + <provider selected="true" editor-type-id="text-editor"> + <state vertical-scroll-proportion="0.0"> + <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> + <folding /> + </state> + </provider> + </entry> + </file> + <file leaf-file-name="reconstruction_linear_test_batch.py" pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/../Script-Vault/scripts - Alt/reconstruction/reconstruction_linear_test_batch.py"> + <provider selected="true" editor-type-id="text-editor"> + <state vertical-scroll-proportion="0.0"> + <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> + <folding /> + </state> + </provider> + </entry> + </file> + <file leaf-file-name="reconstruction_sparse_cg_singular_values.py" pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/../Script-Vault/scripts - Alt/reconstruction/reconstruction_sparse_cg_singular_values.py"> + <provider selected="true" editor-type-id="text-editor"> + <state vertical-scroll-proportion="0.0"> + <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> + <folding /> + </state> + </provider> + </entry> + </file> + <file leaf-file-name="compare_kernels.py" pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/../Script-Vault/scripts - Alt/test methods/compare_kernels.py"> + <provider selected="true" editor-type-id="text-editor"> + <state vertical-scroll-proportion="0.0"> + <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> + <folding /> + </state> + </provider> + </entry> + </file> + <file leaf-file-name="compare_methods.py" pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/../Script-Vault/scripts - Alt/test methods/compare_methods.py"> + <provider selected="true" editor-type-id="text-editor"> + <state vertical-scroll-proportion="0.0"> + <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> + <folding /> + </state> + </provider> + </entry> + </file> + <file leaf-file-name="compare_pixel_fields.py" pinned="false" current-in-tab="true"> + <entry file="file://$PROJECT_DIR$/../Script-Vault/scripts - Alt/test methods/compare_pixel_fields.py"> + <provider selected="true" editor-type-id="text-editor"> + <state vertical-scroll-proportion="0.37866354"> + <caret line="79" column="31" selection-start-line="79" selection-start-column="31" selection-end-line="79" selection-end-column="31" /> + <folding /> + </state> + </provider> + </entry> + </file> + <file leaf-file-name="kernel.py" pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/pyramid/kernel.py"> + <provider selected="true" editor-type-id="text-editor"> + <state vertical-scroll-proportion="0.0"> + <caret line="112" column="43" selection-start-line="112" selection-start-column="43" selection-end-line="112" selection-end-column="43" /> + <folding /> + </state> + </provider> + </entry> + </file> + <file leaf-file-name="phasemap.py" pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/pyramid/phasemap.py"> + <provider selected="true" editor-type-id="text-editor"> + <state vertical-scroll-proportion="0.0"> + <caret line="154" column="16" selection-start-line="154" selection-start-column="16" selection-end-line="154" selection-end-column="16" /> + <folding /> + </state> + </provider> + </entry> + </file> + <file leaf-file-name="pydev_run_in_console.py" pinned="false" current-in-tab="false"> + <entry file="file://$APPLICATION_HOME_DIR$/helpers/pydev/pydev_run_in_console.py"> + <provider selected="true" editor-type-id="text-editor"> + <state vertical-scroll-proportion="0.0"> + <caret line="28" column="0" selection-start-line="28" selection-start-column="0" selection-end-line="28" selection-end-column="0" /> <folding /> </state> </provider> @@ -57,61 +209,63 @@ <component name="IdeDocumentHistory"> <option name="CHANGED_PATHS"> <list> - <option value="$PROJECT_DIR$/../Publications/paper 2/paper2_part3_experiment.py" /> - <option value="$PROJECT_DIR$/../Publications/pico 2015/poster_pico2015_2d.py" /> - <option value="$PROJECT_DIR$/pyramid/numcore/__init__.py" /> - <option value="$PROJECT_DIR$/../HyperSpy/hyperspy/_signals/phase_image.py" /> - <option value="$PROJECT_DIR$/../HyperSpy/hyperspy/signals.py" /> - <option value="$PROJECT_DIR$/pyramid/costfunction.py" /> - <option value="$PROJECT_DIR$/pyramid/regularisator.py" /> - <option value="$PROJECT_DIR$/pyramid/dataset.py" /> - <option value="$PROJECT_DIR$/docs/index.rst" /> - <option value="$PROJECT_DIR$/docs/pyramid.rst" /> - <option value="$PROJECT_DIR$/pyramid/colormap.py" /> - <option value="$PROJECT_DIR$/pyramid/ramp.py" /> - <option value="$PROJECT_DIR$/docs/conf.py" /> - <option value="$PROJECT_DIR$/pyramid/quaternion.py" /> + <option value="$PROJECT_DIR$/../HyperSpy/hyperspy/tests/io/test_emd.py" /> + <option value="$PROJECT_DIR$/pyramid/__init__.py" /> + <option value="C:/Anaconda2/Lib/site-packages/nbformat/__init__.py" /> + <option value="C:/Anaconda2/Lib/site-packages/jsonschema/validators.py" /> + <option value="$PROJECT_DIR$/../HyperSpy/hyperspy/__init__.py" /> + <option value="$APPLICATION_HOME_DIR$/helpers/pydev/pydev_ipython/qt_loaders.py" /> + <option value="C:/Anaconda2/Lib/pkgutil.py" /> + <option value="C:/Anaconda2/Lib/site-packages/nbconvert/exporters/pdf.py" /> + <option value="C:/Anaconda2/Lib/subprocess.py" /> <option value="$PROJECT_DIR$/scripts/reconstruction/reconstruction_3d_from_magdata.py" /> - <option value="$PROJECT_DIR$/pyramid/forwardmodel.py" /> - <option value="$PROJECT_DIR$/pyramid/fft.py" /> - <option value="$PROJECT_DIR$/pyramid/version.py" /> + <option value="$PROJECT_DIR$/scripts/reconstruction/reconstruction_2d_from_phasemap.py" /> + <option value="$PROJECT_DIR$/scripts/phasemap/phasemap_tilt_series.py" /> + <option value="$PROJECT_DIR$/scripts/phasemap/phasemap_from_raw.py" /> + <option value="$PROJECT_DIR$/scripts/phasemap/phasemap_from_image.py" /> + <option value="$PROJECT_DIR$/scripts/phasemap/phasemap_projection_arbitrary.py" /> + <option value="$PROJECT_DIR$/scripts/phasemap/phasemap_from_dm3.py" /> + <option value="$PROJECT_DIR$/scripts/magdata/magdata_from_vtk.py" /> + <option value="$PROJECT_DIR$/scripts/magdata/magdata_from_txtfortran.py" /> + <option value="$PROJECT_DIR$/scripts/magdata/magdata_from_dat.py" /> + <option value="$PROJECT_DIR$/pyramid/fielddata.py" /> + <option value="$PROJECT_DIR$/scripts/magdata/magcreator/create_core_shell_sphere.py" /> + <option value="$PROJECT_DIR$/scripts/magdata/magcreator/create_array_sphere_disc_slab.py" /> + <option value="$PROJECT_DIR$/scripts/magdata/magcreator/create_horseshoe.py" /> + <option value="$PROJECT_DIR$/scripts/magdata/magcreator/create_core_shell_disc.py" /> + <option value="$PROJECT_DIR$/scripts/magdata/magcreator/create_paper2_vortex_slab.py" /> + <option value="$PROJECT_DIR$/scripts/magdata/magcreator/create_vortex_slab.py" /> + <option value="$PROJECT_DIR$/scripts/magdata/magcreator/create_random_slabs.py" /> + <option value="$PROJECT_DIR$/scripts/magdata/magcreator/create_random_pixels.py" /> + <option value="$PROJECT_DIR$/scripts/magdata/magcreator/create_alternating_filaments.py" /> + <option value="$PROJECT_DIR$/scripts/magdata/magcreator/create_singularity.py" /> + <option value="$PROJECT_DIR$/scripts/magdata/magcreator/create_homog_filament.py" /> + <option value="$PROJECT_DIR$/scripts/magdata/magcreator/create_vortex_sphere.py" /> + <option value="$PROJECT_DIR$/scripts/magdata/magcreator/create_flat_homog_slab.py" /> + <option value="$PROJECT_DIR$/scripts/magdata/magcreator/create_pyramid_logo.py" /> + <option value="$PROJECT_DIR$/scripts/magdata/magcreator/create_flat_vortex_slab.py" /> + <option value="$PROJECT_DIR$/scripts/magdata/magcreator/create_vortex_disc.py" /> + <option value="$PROJECT_DIR$/scripts/magdata/magcreator/create_homog_disc.py" /> + <option value="$PROJECT_DIR$/scripts/magdata/magcreator/create_homog_pixel.py" /> + <option value="$PROJECT_DIR$/scripts/magdata/magcreator/create_homog_slab.py" /> + <option value="$PROJECT_DIR$/scripts/magdata/magcreator/create_homog_sphere.py" /> <option value="$PROJECT_DIR$/setup.py" /> - <option value="$PROJECT_DIR$/pyramid/tests/test_dataset.py" /> - <option value="$PROJECT_DIR$/pyramid/tests/test_phasemap.py" /> - <option value="$PROJECT_DIR$/pyramid/tests/test_magcreator.py" /> - <option value="$PROJECT_DIR$/pyramid/tests/test_kernel.py" /> - <option value="$PROJECT_DIR$/pyramid/tests/test_forwardmodel.py" /> - <option value="$PROJECT_DIR$/pyramid/tests/test_costfunction.py" /> - <option value="$PROJECT_DIR$/pyramid/tests/test_projector.py" /> - <option value="$PROJECT_DIR$/pyramid/tests/test_regularisator.py" /> - <option value="$PROJECT_DIR$/pyramid/tests/test_analytic.py" /> - <option value="$PROJECT_DIR$/pyramid/config.py" /> - <option value="$PROJECT_DIR$/pyramid/analytic.py" /> - <option value="$USER_HOME$/Downloads/Untitled.py" /> - <option value="$PROJECT_DIR$/pyramid/__init__.py" /> - <option value="$PROJECT_DIR$/scripts/gui/mag_slicer.py" /> - <option value="$PROJECT_DIR$/pyramid/fieldconverter.py" /> - <option value="$PROJECT_DIR$/pyramid/kernel.py" /> + <option value="$PROJECT_DIR$/scripts/gui/phasemap_creator.py" /> <option value="$PROJECT_DIR$/pyramid/reconstruction.py" /> - <option value="$PROJECT_DIR$/pyramid/magdata.py" /> - <option value="$PROJECT_DIR$/../Publications/pico 2015/logfile.log" /> - <option value="$PROJECT_DIR$/pyramid/phasemap.py" /> - <option value="$PROJECT_DIR$/pyramid/diagnostics.py" /> - <option value="$PROJECT_DIR$/pyramid/magcreator.py" /> - <option value="$PROJECT_DIR$/pyramid/circle_interpolation.py" /> - <option value="$PROJECT_DIR$/../Script-Vault/circle_interpolation.py" /> - <option value="$PROJECT_DIR$/pyramid/tests/test_magdata.py" /> - <option value="$PROJECT_DIR$/pyramid/tests/test_fielddata.py" /> - <option value="$PROJECT_DIR$/../Publications/nanowire_z_angle.py" /> <option value="$PROJECT_DIR$/pyramid/projector.py" /> - <option value="$PROJECT_DIR$/pyramid/fielddata.py" /> - <option value="$PROJECT_DIR$/pyramid/tests/test_phasemapper.py" /> <option value="$PROJECT_DIR$/pyramid/phasemapper.py" /> - <option value="$PROJECT_DIR$/scripts/phasemap/phasemap_tilt_series.py" /> + <option value="$PROJECT_DIR$/pyramid/phasemap.py" /> + <option value="$PROJECT_DIR$/pyramid/diagnostics.py" /> + <option value="$PROJECT_DIR$/pyramid/dataset.py" /> + <option value="$PROJECT_DIR$/scripts/gui/mag_slicer.py" /> + <option value="$PROJECT_DIR$/pyramid/kernel.py" /> + <option value="$PROJECT_DIR$/../Script-Vault/scripts - Alt/test methods/compare_pixel_fields.py" /> </list> </option> </component> <component name="NamedScopeManager"> + <scope name="scripts" pattern="file[Pyramid]:scripts/*" /> + <scope name="gui" pattern="file[Pyramid]:scripts/gui/*" /> <order> <scope name="__init__" /> <scope name="*.c" /> @@ -142,7 +296,7 @@ </expanded-state> <selected-state> <State> - <id>LongLine</id> + <id>PyArgumentListInspection</id> </State> </selected-state> </profile-state> @@ -173,7 +327,6 @@ <foldersAlwaysOnTop value="true" /> </navigator> <panes> - <pane id="Scope" /> <pane id="Scratches" /> <pane id="ProjectPane"> <subPane> @@ -183,6 +336,70 @@ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" /> </PATH_ELEMENT> </PATH> + <PATH> + <PATH_ELEMENT> + <option name="myItemId" value="Pyramid" /> + <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" /> + </PATH_ELEMENT> + <PATH_ELEMENT> + <option name="myItemId" value="Script-Vault" /> + <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> + </PATH_ELEMENT> + </PATH> + <PATH> + <PATH_ELEMENT> + <option name="myItemId" value="Pyramid" /> + <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" /> + </PATH_ELEMENT> + <PATH_ELEMENT> + <option name="myItemId" value="Script-Vault" /> + <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> + </PATH_ELEMENT> + <PATH_ELEMENT> + <option name="myItemId" value="scripts - Alt" /> + <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> + </PATH_ELEMENT> + <PATH_ELEMENT> + <option name="myItemId" value="test methods" /> + <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> + </PATH_ELEMENT> + </PATH> + <PATH> + <PATH_ELEMENT> + <option name="myItemId" value="Pyramid" /> + <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" /> + </PATH_ELEMENT> + <PATH_ELEMENT> + <option name="myItemId" value="Script-Vault" /> + <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> + </PATH_ELEMENT> + <PATH_ELEMENT> + <option name="myItemId" value="scripts - Alt" /> + <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> + </PATH_ELEMENT> + <PATH_ELEMENT> + <option name="myItemId" value="reconstruction" /> + <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> + </PATH_ELEMENT> + </PATH> + <PATH> + <PATH_ELEMENT> + <option name="myItemId" value="Pyramid" /> + <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" /> + </PATH_ELEMENT> + <PATH_ELEMENT> + <option name="myItemId" value="Script-Vault" /> + <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> + </PATH_ELEMENT> + <PATH_ELEMENT> + <option name="myItemId" value="scripts - Alt" /> + <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> + </PATH_ELEMENT> + <PATH_ELEMENT> + <option name="myItemId" value="collaborations" /> + <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> + </PATH_ELEMENT> + </PATH> <PATH> <PATH_ELEMENT> <option name="myItemId" value="Pyramid" /> @@ -209,6 +426,7 @@ </PATH> </subPane> </pane> + <pane id="Scope" /> <pane id="ColorIdeProjectViewPane"> <subPane> <PATH> @@ -232,7 +450,7 @@ </panes> </component> <component name="PropertiesComponent"> - <property name="settings.editor.selected.configurable" value="editor.preferences.tabs" /> + <property name="settings.editor.selected.configurable" value="project.scopes" /> <property name="settings.editor.splitter.proportion" value="0.2" /> <property name="last_opened_file_path" value="$PROJECT_DIR$/files/vecdata" /> <property name="FileHistory.org.zmlx.hg4idea.provider.HgHistoryProvider_flatWidth0" value="44" /> @@ -253,7 +471,7 @@ <property name="FileHistory.org.zmlx.hg4idea.provider.HgHistoryProvider_treeOrder3" value="3" /> <property name="last.edited.regexp" value="asdf aasfasf.version_info " /> <property name="restartRequiresConfirmation" value="false" /> - <property name="SearchEverywhereHistoryKey" value="colorwheel	null	null" /> + <property name="SearchEverywhereHistoryKey" value="nbconvert	null	null boto.vendored.six._SixMetaPathImporter	null	null pkg_resources.extern.VendorImporter	null	null colorwheel	null	null" /> </component> <component name="Push.Settings"> <excluded-roots> @@ -279,8 +497,8 @@ <recent name="C:\Users\Jan\Home\PhD Thesis\Projects\Script-Vault" /> </key> </component> - <component name="RunManager" selected="Python tests.Pyramid Tests"> - <configuration default="false" name="magdata" type="PythonConfigurationType" factoryName="Python" temporary="true"> + <component name="RunManager" selected="Python.compare_pixel_fields"> + <configuration default="false" name="config" type="PythonConfigurationType" factoryName="Python" temporary="true"> <option name="INTERPRETER_OPTIONS" value="" /> <option name="PARENT_ENVS" value="true" /> <envs> @@ -292,85 +510,77 @@ <option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" /> <module name="Pyramid" /> - <option name="SCRIPT_NAME" value="C:\Users\Jan\Home\PhD Thesis\Projects\Pyramid\pyramid\fielddata.py" /> + <option name="SCRIPT_NAME" value="$PROJECT_DIR$/pyramid/config.py" /> <option name="PARAMETERS" value="" /> <option name="SHOW_COMMAND_LINE" value="true" /> <method /> </configuration> - <configuration default="false" name="circle_interpolation" type="PythonConfigurationType" factoryName="Python" singleton="true" temporary="true"> + <configuration default="false" name="colormap" type="PythonConfigurationType" factoryName="Python" temporary="true"> <option name="INTERPRETER_OPTIONS" value="" /> <option name="PARENT_ENVS" value="true" /> <envs> <env name="PYTHONUNBUFFERED" value="1" /> </envs> - <option name="SDK_HOME" value="" /> - <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/../Script-Vault" /> + <option name="SDK_HOME" value="C:\Anaconda2\python.exe" /> + <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/pyramid" /> <option name="IS_MODULE_SDK" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" /> - <module name="Script-Vault" /> - <option name="SCRIPT_NAME" value="$PROJECT_DIR$/../Script-Vault/circle_interpolation.py" /> + <module name="Pyramid" /> + <option name="SCRIPT_NAME" value="$PROJECT_DIR$/pyramid/colormap.py" /> <option name="PARAMETERS" value="" /> <option name="SHOW_COMMAND_LINE" value="true" /> <method /> </configuration> - <configuration default="false" name="test_fielddata" type="PythonConfigurationType" factoryName="Python" temporary="true"> + <configuration default="false" name="analytic" type="PythonConfigurationType" factoryName="Python" temporary="true"> <option name="INTERPRETER_OPTIONS" value="" /> <option name="PARENT_ENVS" value="true" /> <envs> <env name="PYTHONUNBUFFERED" value="1" /> </envs> <option name="SDK_HOME" value="C:\Anaconda2\python.exe" /> - <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/pyramid/tests" /> + <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/pyramid" /> <option name="IS_MODULE_SDK" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" /> <module name="Pyramid" /> - <option name="SCRIPT_NAME" value="$PROJECT_DIR$/pyramid/tests/test_fielddata.py" /> + <option name="SCRIPT_NAME" value="$PROJECT_DIR$/pyramid/analytic.py" /> <option name="PARAMETERS" value="" /> <option name="SHOW_COMMAND_LINE" value="true" /> <method /> </configuration> - <configuration default="false" name="Nosetest TestCasePhaseMapperMIP.test_call" type="tests" factoryName="Nosetests" temporary="true" nameIsGenerated="true"> + <configuration default="false" name="__init__" type="PythonConfigurationType" factoryName="Python" temporary="true"> <option name="INTERPRETER_OPTIONS" value="" /> <option name="PARENT_ENVS" value="true" /> - <envs /> - <option name="SDK_HOME" value="" /> - <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/pyramid/tests" /> + <envs> + <env name="PYTHONUNBUFFERED" value="1" /> + </envs> + <option name="SDK_HOME" value="C:\Anaconda2\python.exe" /> + <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/pyramid" /> <option name="IS_MODULE_SDK" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" /> <module name="Pyramid" /> - <option name="SCRIPT_NAME" value="$PROJECT_DIR$/pyramid/tests/test_phasemapper.py" /> - <option name="CLASS_NAME" value="TestCasePhaseMapperMIP" /> - <option name="METHOD_NAME" value="test_call" /> - <option name="FOLDER_NAME" value="" /> - <option name="TEST_TYPE" value="TEST_METHOD" /> - <option name="PATTERN" value="" /> - <option name="USE_PATTERN" value="false" /> - <option name="PARAMS" value="" /> - <option name="USE_PARAM" value="false" /> + <option name="SCRIPT_NAME" value="$PROJECT_DIR$/pyramid/__init__.py" /> + <option name="PARAMETERS" value="" /> + <option name="SHOW_COMMAND_LINE" value="true" /> <method /> </configuration> - <configuration default="false" name="Nosetests in test_phasemapper" type="tests" factoryName="Nosetests" temporary="true" nameIsGenerated="true"> + <configuration default="false" name="compare_pixel_fields" type="PythonConfigurationType" factoryName="Python" temporary="true"> <option name="INTERPRETER_OPTIONS" value="" /> <option name="PARENT_ENVS" value="true" /> - <envs /> - <option name="SDK_HOME" value="" /> - <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/pyramid/tests" /> + <envs> + <env name="PYTHONUNBUFFERED" value="1" /> + </envs> + <option name="SDK_HOME" value="C:\Anaconda2\python.exe" /> + <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/../Script-Vault/scripts - Alt/test methods" /> <option name="IS_MODULE_SDK" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" /> - <module name="Pyramid" /> - <option name="SCRIPT_NAME" value="$PROJECT_DIR$/pyramid/tests/test_phasemapper.py" /> - <option name="CLASS_NAME" value="" /> - <option name="METHOD_NAME" value="" /> - <option name="FOLDER_NAME" value="" /> - <option name="TEST_TYPE" value="TEST_SCRIPT" /> - <option name="PATTERN" value="" /> - <option name="USE_PATTERN" value="false" /> - <option name="PARAMS" value="" /> - <option name="USE_PARAM" value="false" /> + <module name="Script-Vault" /> + <option name="SCRIPT_NAME" value="$PROJECT_DIR$/../Script-Vault/scripts - Alt/test methods/compare_pixel_fields.py" /> + <option name="PARAMETERS" value="" /> + <option name="SHOW_COMMAND_LINE" value="true" /> <method /> </configuration> <configuration default="true" type="CompoundRunConfigurationType" factoryName="Compound Run Configuration"> @@ -592,19 +802,19 @@ <item index="1" class="java.lang.String" itemvalue="Python.fieldconverter" /> <item index="2" class="java.lang.String" itemvalue="Python docs.Pyramid Sphinx" /> <item index="3" class="java.lang.String" itemvalue="Python tests.Pyramid Tests" /> - <item index="4" class="java.lang.String" itemvalue="Python.magdata" /> - <item index="5" class="java.lang.String" itemvalue="Python.circle_interpolation" /> - <item index="6" class="java.lang.String" itemvalue="Python.test_fielddata" /> - <item index="7" class="java.lang.String" itemvalue="Python tests.Nosetest TestCasePhaseMapperMIP.test_call" /> - <item index="8" class="java.lang.String" itemvalue="Python tests.Nosetests in test_phasemapper" /> + <item index="4" class="java.lang.String" itemvalue="Python.config" /> + <item index="5" class="java.lang.String" itemvalue="Python.colormap" /> + <item index="6" class="java.lang.String" itemvalue="Python.analytic" /> + <item index="7" class="java.lang.String" itemvalue="Python.__init__" /> + <item index="8" class="java.lang.String" itemvalue="Python.compare_pixel_fields" /> </list> <recent_temporary> <list size="5"> - <item index="0" class="java.lang.String" itemvalue="Python tests.Nosetests in test_phasemapper" /> - <item index="1" class="java.lang.String" itemvalue="Python tests.Nosetest TestCasePhaseMapperMIP.test_call" /> - <item index="2" class="java.lang.String" itemvalue="Python.test_fielddata" /> - <item index="3" class="java.lang.String" itemvalue="Python.circle_interpolation" /> - <item index="4" class="java.lang.String" itemvalue="Python.magdata" /> + <item index="0" class="java.lang.String" itemvalue="Python.compare_pixel_fields" /> + <item index="1" class="java.lang.String" itemvalue="Python.__init__" /> + <item index="2" class="java.lang.String" itemvalue="Python.analytic" /> + <item index="3" class="java.lang.String" itemvalue="Python.colormap" /> + <item index="4" class="java.lang.String" itemvalue="Python.config" /> </list> </recent_temporary> </component> @@ -683,21 +893,33 @@ <option name="project" value="LOCAL" /> <updated>1457519303095</updated> </task> - <option name="localTasksCounter" value="11" /> + <task id="LOCAL-00011" summary="Refactoring: Replaced MagData with VectorData and added ScalarData class (and common superclass FieldData). magnitude is now called field (which is more appropriate) projector now uses FieldData to process both vector and scalar data (foundation was in place before)"> + <created>1457523017286</created> + <option name="number" value="00011" /> + <option name="project" value="LOCAL" /> + <updated>1457523017286</updated> + </task> + <task id="LOCAL-00012" summary="Refactoring: Replaced MagData with VectorData and added ScalarData class (and common superclass FieldData). magnitude is now called field (which is more appropriate) projector now uses FieldData to process both vector and scalar data (foundation was in place before)"> + <created>1457523121814</created> + <option name="number" value="00012" /> + <option name="project" value="LOCAL" /> + <updated>1457523121814</updated> + </task> + <task id="LOCAL-00013" summary="Updated long overdue scripts to work with new layout and refactoring!"> + <created>1458723675103</created> + <option name="number" value="00013" /> + <option name="project" value="LOCAL" /> + <updated>1458723675103</updated> + </task> + <option name="localTasksCounter" value="14" /> <servers /> </component> <component name="TestHistory"> - <history-entry file="Nosetest_TestCasePhaseMapperElectric_test_call - 2016.03.09 at 11h 05m 56s.xml"> - <configuration name="Nosetest TestCasePhaseMapperElectric.test_call" configurationId="tests" /> - </history-entry> - <history-entry file="Nosetests_in_test_phasemapper - 2016.03.09 at 11h 06m 54s.xml"> - <configuration name="Nosetests in test_phasemapper" configurationId="tests" /> - </history-entry> - <history-entry file="Pyramid_Tests - 2016.03.07 at 10h 44m 21s.xml"> - <configuration name="Pyramid Tests" configurationId="tests" /> + <history-entry file="Nosetests_in_test_emd - 2016.03.11 at 09h 20m 49s.xml"> + <configuration name="Nosetests in test_emd" configurationId="tests" /> </history-entry> - <history-entry file="Pyramid_Tests - 2016.03.07 at 14h 56m 25s.xml"> - <configuration name="Pyramid Tests" configurationId="tests" /> + <history-entry file="Nosetests_in_test_emd - 2016.03.11 at 09h 30m 44s.xml"> + <configuration name="Nosetests in test_emd" configurationId="tests" /> </history-entry> <history-entry file="Pyramid_Tests - 2016.03.08 at 21h 37m 05s.xml"> <configuration name="Pyramid Tests" configurationId="tests" /> @@ -717,6 +939,12 @@ <history-entry file="Pyramid_Tests - 2016.03.09 at 11h 07m 10s.xml"> <configuration name="Pyramid Tests" configurationId="tests" /> </history-entry> + <history-entry file="Pyramid_Tests - 2016.03.11 at 15h 02m 03s.xml"> + <configuration name="Pyramid Tests" configurationId="tests" /> + </history-entry> + <history-entry file="Pyramid_Tests - 2016.03.22 at 16h 50m 06s.xml"> + <configuration name="Pyramid Tests" configurationId="tests" /> + </history-entry> </component> <component name="TodoView" selected-index="3"> <todo-panel id="selected-file"> @@ -731,26 +959,47 @@ <frame x="-8" y="-8" width="1936" height="1056" extended-state="6" /> <editor active="true" /> <layout> - <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.13859275" sideWeight="0.49186993" order="0" side_tool="false" content_ui="combo" /> + <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.16897655" sideWeight="0.49186993" order="0" side_tool="false" content_ui="combo" /> <window_info id="TODO" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3219616" sideWeight="0.49746513" order="9" side_tool="false" content_ui="tabs" x="-33" y="355" width="1594" height="283" /> <window_info id="Messages" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3326226" sideWeight="0.5" order="12" side_tool="false" content_ui="tabs" /> - <window_info id="Event Log" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.42866325" sideWeight="0.50253487" order="8" side_tool="false" content_ui="tabs" /> - <window_info id="Find" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.34168443" sideWeight="0.5" order="13" side_tool="false" content_ui="tabs" /> - <window_info id="Python Console" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.3379531" sideWeight="0.49746513" order="3" side_tool="false" content_ui="tabs" /> - <window_info id="Version Control" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.44136462" sideWeight="0.49746513" order="7" side_tool="false" content_ui="tabs" /> - <window_info id="Run" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32622603" sideWeight="0.49746513" order="4" side_tool="false" content_ui="tabs" /> - <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.16684435" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> + <window_info id="Event Log" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.42802057" sideWeight="0.50253487" order="8" side_tool="false" content_ui="tabs" /> + <window_info id="Python Console" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.35927504" sideWeight="0.49746513" order="3" side_tool="false" content_ui="tabs" /> + <window_info id="Version Control" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.45095947" sideWeight="0.49746513" order="7" side_tool="false" content_ui="tabs" /> + <window_info id="Run" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.35980812" sideWeight="0.49746513" order="4" side_tool="false" content_ui="tabs" /> + <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.09808102" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> <window_info id="Terminal" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.43316194" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" /> <window_info id="Favorites" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.4224" sideWeight="0.5081301" order="11" side_tool="false" content_ui="tabs" /> - <window_info id="Debug" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32518336" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" /> + <window_info id="Debug" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.35714287" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" /> <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" /> <window_info id="Inspection" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.37596402" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" /> <window_info id="Thumbnails" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="WINDOWED" visible="false" show_stripe_button="false" weight="0.3708108" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" x="6" y="307" width="1908" height="381" /> <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" /> + <window_info id="Find" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.34168443" sideWeight="0.5" order="13" side_tool="false" content_ui="tabs" /> <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> </layout> + <layout-to-restore> + <window_info id="TODO" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3219616" sideWeight="0.49746513" order="9" side_tool="false" content_ui="tabs" x="-33" y="355" width="1594" height="283" /> + <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> + <window_info id="Messages" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3326226" sideWeight="0.5" order="12" side_tool="false" content_ui="tabs" /> + <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> + <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" /> + <window_info id="Event Log" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.42857143" sideWeight="0.50253487" order="8" side_tool="false" content_ui="tabs" /> + <window_info id="Inspection" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.37596402" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" /> + <window_info id="Python Console" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.3611825" sideWeight="0.49746513" order="3" side_tool="false" content_ui="tabs" /> + <window_info id="Version Control" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.44136462" sideWeight="0.49746513" order="7" side_tool="false" content_ui="tabs" /> + <window_info id="Run" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32334962" sideWeight="0.49746513" order="4" side_tool="false" content_ui="tabs" /> + <window_info id="Thumbnails" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="WINDOWED" visible="false" show_stripe_button="false" weight="0.3708108" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" x="6" y="307" width="1908" height="381" /> + <window_info id="Terminal" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.43316194" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" /> + <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.11311054" sideWeight="0.49186993" order="0" side_tool="false" content_ui="combo" /> + <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" /> + <window_info id="Find" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.34168443" sideWeight="0.5" order="13" side_tool="false" content_ui="tabs" /> + <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.09808102" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> + <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> + <window_info id="Favorites" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.4224" sideWeight="0.5081301" order="11" side_tool="false" content_ui="tabs" /> + <window_info id="Debug" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32455012" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" /> + </layout-to-restore> </component> <component name="Vcs.Log.UiProperties"> <option name="SHOW_ROOT_NAMES" value="true" /> @@ -780,7 +1029,8 @@ <MESSAGE value="Commit after Reformatting with PyCharms!" /> <MESSAGE value="Added fieldconverter module! fieldconverter: methods to convert M to A to B magdata: a bit more parameters for quiver_plot3d(), added contour_plot3d() phasemapper: pm() extended for different projections (not just simple) kernel: u and v switched (now named after the unit magnetization direction, which makes much more sense)" /> <MESSAGE value="Refactoring: Replaced MagData with VectorData and added ScalarData class (and common superclass FieldData). magnitude is now called field (which is more appropriate) projector now uses FieldData to process both vector and scalar data (foundation was in place before)" /> - <option name="LAST_COMMIT_MESSAGE" value="Refactoring: Replaced MagData with VectorData and added ScalarData class (and common superclass FieldData). magnitude is now called field (which is more appropriate) projector now uses FieldData to process both vector and scalar data (foundation was in place before)" /> + <MESSAGE value="Updated long overdue scripts to work with new layout and refactoring!" /> + <option name="LAST_COMMIT_MESSAGE" value="Updated long overdue scripts to work with new layout and refactoring!" /> <option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="true" /> <option name="REARRANGE_BEFORE_PROJECT_COMMIT" value="true" /> <option name="CHANGE_BROWSER_SETTINGS"> @@ -800,9 +1050,9 @@ <breakpoint-manager> <breakpoints> <line-breakpoint enabled="true" type="python-line"> - <url>file://$PROJECT_DIR$/../HyperSpy/hyperspy/io.py</url> - <line>343</line> - <option name="timeStamp" value="11" /> + <url>file://$PROJECT_DIR$/pyramid/phasemap.py</url> + <line>157</line> + <option name="timeStamp" value="69" /> </line-breakpoint> </breakpoints> <breakpoints-dialog> @@ -815,353 +1065,363 @@ </properties> </breakpoint> </default-breakpoints> - <option name="time" value="60" /> + <option name="time" value="72" /> </breakpoint-manager> <watches-manager /> </component> <component name="editorHistoryManager"> - <entry file="file://$PROJECT_DIR$/pyramid/logging.ini"> + <entry file="file://$PROJECT_DIR$/scripts/magdata/magcreator/create_core_shell_disc.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.59002167"> - <caret line="32" column="13" selection-start-line="32" selection-start-column="13" selection-end-line="32" selection-end-column="13" /> + <state vertical-scroll-proportion="0.567297"> + <caret line="30" column="0" selection-start-line="30" selection-start-column="0" selection-end-line="30" selection-end-column="0" /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/scripts/reconstruction/reconstruction_2d_from_phasemap.py"> + <entry file="file://$PROJECT_DIR$/scripts/magdata/magcreator/create_flat_vortex_slab.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0"> - <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> + <state vertical-scroll-proportion="0.4916574"> + <caret line="26" column="0" selection-start-line="26" selection-start-column="0" selection-end-line="26" selection-end-column="0" /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/pyramid/version.py"> + <entry file="file://$PROJECT_DIR$/scripts/magdata/magcreator/create_core_shell_sphere.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0945758"> - <caret line="4" column="0" selection-start-line="4" selection-start-column="0" selection-end-line="4" selection-end-column="0" /> + <state vertical-scroll-proportion="0.4538376"> + <caret line="24" column="58" selection-start-line="24" selection-start-column="58" selection-end-line="24" selection-end-column="58" /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/setup.py"> + <entry file="file://$PROJECT_DIR$/scripts/magdata/magcreator/create_vortex_disc.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.32962447"> - <caret line="103" column="0" selection-start-line="103" selection-start-column="0" selection-end-line="103" selection-end-column="0" /> + <state vertical-scroll-proportion="0.3214683"> + <caret line="17" column="17" selection-start-line="17" selection-start-column="17" selection-end-line="17" selection-end-column="17" /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/pyramid/tests/test_dataset.py"> + <entry file="file://$PROJECT_DIR$/scripts/magdata/magcreator/create_horseshoe.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.17097701"> - <caret line="7" column="0" selection-start-line="7" selection-start-column="0" selection-end-line="7" selection-end-column="0" /> + <state vertical-scroll-proportion="0.55314535"> + <caret line="30" column="0" selection-start-line="30" selection-start-column="0" selection-end-line="30" selection-end-column="0" /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/pyramid/tests/test_phasemap.py"> + <entry file="file://$PROJECT_DIR$/scripts/magdata/magcreator/create_homog_disc.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.21982759"> - <caret line="9" column="37" selection-start-line="9" selection-start-column="37" selection-end-line="9" selection-end-column="37" /> + <state vertical-scroll-proportion="0.46095446"> + <caret line="25" column="0" selection-start-line="25" selection-start-column="0" selection-end-line="25" selection-end-column="0" /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/pyramid/tests/test_magcreator.py"> + <entry file="file://$PROJECT_DIR$/scripts/magdata/magcreator/create_homog_pixel.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0"> - <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> + <state vertical-scroll-proportion="0.29501083"> + <caret line="16" column="27" selection-start-line="16" selection-start-column="27" selection-end-line="16" selection-end-column="27" /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/pyramid/tests/test_forwardmodel.py"> + <entry file="file://$PROJECT_DIR$/scripts/magdata/magcreator/create_homog_slab.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0"> - <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> + <state vertical-scroll-proportion="0.31344903"> + <caret line="17" column="6" selection-start-line="17" selection-start-column="6" selection-end-line="17" selection-end-column="6" /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/pyramid/tests/test_projector.py"> + <entry file="file://$PROJECT_DIR$/scripts/magdata/magcreator/create_homog_sphere.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0"> - <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> + <state vertical-scroll-proportion="0.51626897"> + <caret line="28" column="0" selection-start-line="28" selection-start-column="0" selection-end-line="28" selection-end-column="0" /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/pyramid/tests/test_regularisator.py"> + <entry file="file://$PROJECT_DIR$/../HyperSpy/setup.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="-1.9097035"> - <caret line="17" column="0" selection-start-line="17" selection-start-column="0" selection-end-line="17" selection-end-column="0" /> + <state vertical-scroll-proportion="0.0"> + <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> + <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/pyramid/tests/test_analytic.py"> + <entry file="file://$PROJECT_DIR$/setup.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.43530998"> - <caret line="19" column="16" selection-start-line="19" selection-start-column="16" selection-end-line="19" selection-end-column="16" /> + <state vertical-scroll-proportion="0.63123643"> + <caret line="149" column="41" selection-start-line="149" selection-start-column="41" selection-end-line="149" selection-end-column="41" /> + <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/pyramid/numcore/phasemapper_core.c"> + <entry file="file://C:/Anaconda2/Lib/site-packages/PIL/Image.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="-5.7277627"> - <caret line="2" column="24" selection-start-line="2" selection-start-column="24" selection-end-line="2" selection-end-column="24" /> + <state vertical-scroll-proportion="0.0"> + <caret line="1301" column="0" selection-start-line="1301" selection-start-column="0" selection-end-line="1301" selection-end-column="0" /> + <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/pyramid/analytic.py"> + <entry file="file://$PROJECT_DIR$/scripts/gui/phasemap_creator.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.9541779"> - <caret line="215" column="31" selection-start-line="215" selection-start-column="31" selection-end-line="215" selection-end-column="31" /> + <state vertical-scroll-proportion="0.71563345"> + <caret line="264" column="0" selection-start-line="264" selection-start-column="0" selection-end-line="264" selection-end-column="0" /> + <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/pyramid/config.py"> + <entry file="file://$PROJECT_DIR$/pyramid/version.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0"> - <caret line="14" column="4" selection-start-line="14" selection-start-column="4" selection-end-line="14" selection-end-column="4" /> + <state vertical-scroll-proportion="0.11258278"> + <caret line="4" column="0" selection-start-line="4" selection-start-column="0" selection-end-line="4" selection-end-column="0" /> <folding /> </state> </provider> </entry> - <entry file="file://C:/Anaconda2/Lib/site-packages/numpy/core/_methods.py"> + <entry file="file://$PROJECT_DIR$/pyramid/regularisator.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="-0.47831184"> - <caret line="24" column="0" selection-start-line="24" selection-start-column="0" selection-end-line="24" selection-end-column="0" /> + <state vertical-scroll-proportion="0.36589405"> + <caret line="13" column="26" selection-start-line="13" selection-start-column="26" selection-end-line="13" selection-end-column="26" /> + <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/scripts/gui/phasemap_creator.py"> + <entry file="file://$PROJECT_DIR$/pyramid/reconstruction.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0"> - <caret line="11" column="10" selection-start-line="11" selection-start-column="10" selection-end-line="11" selection-end-column="10" /> + <state vertical-scroll-proportion="0.1768202"> + <caret line="7" column="72" selection-start-line="7" selection-start-column="72" selection-end-line="7" selection-end-column="72" /> <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/pyramid/forwardmodel.py"> + <entry file="file://$PROJECT_DIR$/pyramid/ramp.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.27511415"> - <caret line="72" column="8" selection-start-line="72" selection-start-column="8" selection-end-line="72" selection-end-column="8" /> + <state vertical-scroll-proportion="0.43965518"> + <caret line="18" column="73" selection-start-line="18" selection-start-column="73" selection-end-line="18" selection-end-column="73" /> + <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/pyramid/fft.py"> + <entry file="file://$PROJECT_DIR$/pyramid/quaternion.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0"> - <caret line="296" column="15" selection-start-line="296" selection-start-column="15" selection-end-line="296" selection-end-column="28" /> + <state vertical-scroll-proportion="0.43965518"> + <caret line="18" column="22" selection-start-line="18" selection-start-column="22" selection-end-line="18" selection-end-column="22" /> <folding /> </state> </provider> </entry> - <entry file="file://C:/Anaconda2/Lib/site-packages/matplotlib/backend_bases.py"> + <entry file="file://$PROJECT_DIR$/pyramid/projector.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.72362554"> - <caret line="2436" column="0" selection-start-line="2436" selection-start-column="0" selection-end-line="2436" selection-end-column="0" /> + <state vertical-scroll-proportion="0.418637"> + <caret line="23" column="0" selection-start-line="23" selection-start-column="0" selection-end-line="23" selection-end-column="0" /> + <folding /> </state> </provider> </entry> - <entry file="file://$APPLICATION_HOME_DIR$/helpers/pydev/pydevd.py"> + <entry file="file://$PROJECT_DIR$/pyramid/phasemapper.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.9346314"> - <caret line="2410" column="0" selection-start-line="2410" selection-start-column="0" selection-end-line="2410" selection-end-column="0" /> + <state vertical-scroll-proportion="0.3678161"> + <caret line="264" column="57" selection-start-line="264" selection-start-column="57" selection-end-line="264" selection-end-column="57" /> + <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/scripts/gui/mag_slicer.py"> + <entry file="file://$PROJECT_DIR$/pyramid/magcreator.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0"> - <caret line="223" column="57" selection-start-line="223" selection-start-column="57" selection-end-line="223" selection-end-column="57" /> + <state vertical-scroll-proportion="0.5354659"> + <caret line="296" column="0" selection-start-line="296" selection-start-column="0" selection-end-line="296" selection-end-column="0" /> <folding /> </state> </provider> </entry> - <entry file="file://$USER_HOME$/Downloads/Untitled.py"> + <entry file="file://$PROJECT_DIR$/pyramid/logging.ini"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0"> - <caret line="44" column="40" selection-start-line="44" selection-start-column="40" selection-end-line="44" selection-end-column="40" /> + <state vertical-scroll-proportion="0.26008344"> + <caret line="11" column="25" selection-start-line="11" selection-start-column="25" selection-end-line="11" selection-end-column="25" /> <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/../Jutil/jutil/cg.py"> + <entry file="file://$PROJECT_DIR$/pyramid/forwardmodel.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0189099"> - <caret line="72" column="18" selection-start-line="72" selection-start-column="18" selection-end-line="72" selection-end-column="18" /> + <state vertical-scroll-proportion="0.25173852"> + <caret line="46" column="0" selection-start-line="46" selection-start-column="0" selection-end-line="46" selection-end-column="0" /> + <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/pyramid/tests/test_kernel.py"> + <entry file="file://$PROJECT_DIR$/pyramid/fielddata.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0"> - <caret line="26" column="0" selection-start-line="26" selection-start-column="0" selection-end-line="26" selection-end-column="0" /> + <state vertical-scroll-proportion="0.472879"> + <caret line="983" column="79" selection-start-line="983" selection-start-column="79" selection-end-line="983" selection-end-column="79" /> <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/pyramid/kernel.py"> + <entry file="file://$PROJECT_DIR$/pyramid/fieldconverter.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0"> - <caret line="95" column="34" selection-start-line="95" selection-start-column="34" selection-end-line="95" selection-end-column="34" /> + <state vertical-scroll-proportion="0.44923505"> + <caret line="91" column="27" selection-start-line="91" selection-start-column="27" selection-end-line="91" selection-end-column="27" /> <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/../Publications/paper 2/paper2_part3_experiment.py"> + <entry file="file://$PROJECT_DIR$/pyramid/fft.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0"> - <caret line="17" column="25" selection-start-line="17" selection-start-column="25" selection-end-line="17" selection-end-column="25" /> + <state vertical-scroll-proportion="0.40194714"> + <caret line="17" column="14" selection-start-line="17" selection-start-column="14" selection-end-line="17" selection-end-column="14" /> <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/../Publications/pico 2015/poster_pico2015_2d.py"> + <entry file="file://$PROJECT_DIR$/pyramid/dataset.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0"> - <caret line="24" column="21" selection-start-line="24" selection-start-column="21" selection-end-line="24" selection-end-column="21" /> + <state vertical-scroll-proportion="0.16037735"> + <caret line="7" column="14" selection-start-line="7" selection-start-column="14" selection-end-line="7" selection-end-column="14" /> <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/../Publications/pico 2015/poster_pico2015_3d.py"> + <entry file="file://$PROJECT_DIR$/pyramid/costfunction.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0"> - <caret line="31" column="45" selection-start-line="31" selection-start-column="45" selection-end-line="31" selection-end-column="45" /> + <state vertical-scroll-proportion="0.34366578"> + <caret line="15" column="0" selection-start-line="15" selection-start-column="0" selection-end-line="15" selection-end-column="0" /> <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/pyramid/fieldconverter.py"> + <entry file="file://$PROJECT_DIR$/pyramid/config.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0"> - <caret line="73" column="30" selection-start-line="73" selection-start-column="30" selection-end-line="73" selection-end-column="30" /> + <state vertical-scroll-proportion="0.3207547"> + <caret line="14" column="4" selection-start-line="14" selection-start-column="4" selection-end-line="14" selection-end-column="4" /> <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/pyramid/diagnostics.py"> + <entry file="file://$PROJECT_DIR$/pyramid/colormap.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0"> - <caret line="183" column="21" selection-start-line="183" selection-start-column="21" selection-end-line="183" selection-end-column="21" /> + <state vertical-scroll-proportion="0.29784366"> + <caret line="13" column="24" selection-start-line="13" selection-start-column="24" selection-end-line="13" selection-end-column="24" /> <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/pyramid/magcreator.py"> + <entry file="file://$PROJECT_DIR$/pyramid/analytic.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0"> - <caret line="309" column="0" selection-start-line="309" selection-start-column="0" selection-end-line="309" selection-end-column="0" /> + <state vertical-scroll-proportion="0.5269542"> + <caret line="23" column="0" selection-start-line="23" selection-start-column="0" selection-end-line="23" selection-end-column="0" /> <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/../Script-Vault/circle_interpolation.py"> + <entry file="file://$PROJECT_DIR$/pyramid/__init__.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.374541"> - <caret line="18" column="23" selection-start-line="18" selection-start-column="23" selection-end-line="18" selection-end-column="23" /> + <state vertical-scroll-proportion="0.56469005"> + <caret line="60" column="17" selection-start-line="60" selection-start-column="17" selection-end-line="60" selection-end-column="17" /> + <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/pyramid/phasemap.py"> + <entry file="file://$PROJECT_DIR$/pyramid/diagnostics.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0"> - <caret line="216" column="23" selection-start-line="216" selection-start-column="23" selection-end-line="216" selection-end-column="23" /> + <state vertical-scroll-proportion="0.20281996"> + <caret line="11" column="37" selection-start-line="11" selection-start-column="37" selection-end-line="11" selection-end-column="37" /> <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/pyramid/tests/test_costfunction.py"> + <entry file="file://$PROJECT_DIR$/scripts/gui/mag_slicer.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0"> - <caret line="43" column="8" selection-start-line="43" selection-start-column="8" selection-end-line="43" selection-end-column="8" /> + <state vertical-scroll-proportion="0.2624729"> + <caret line="213" column="42" selection-start-line="213" selection-start-column="42" selection-end-line="213" selection-end-column="42" /> <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/../Publications/paper 2/paper2_part2_simulation.py"> + <entry file="file://$PROJECT_DIR$/../Script-Vault/scripts - Alt/collaborations/example_joern.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.020807834"> - <caret line="17" column="25" selection-start-line="17" selection-start-column="25" selection-end-line="17" selection-end-column="25" /> + <state vertical-scroll-proportion="0.0"> + <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/../Publications/nanowire_z_angle.py"> + <entry file="file://$PROJECT_DIR$/../Script-Vault/scripts - Alt/collaborations/patrick_nanowire_reconstruction.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.29974812"> - <caret line="14" column="51" selection-start-line="14" selection-start-column="51" selection-end-line="14" selection-end-column="51" /> + <state vertical-scroll-proportion="0.0"> + <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/pyramid/projector.py"> + <entry file="file://$PROJECT_DIR$/../Script-Vault/scripts - Alt/collaborations/patrick_nanowire_reconstruction_simulation.py"> <provider selected="true" editor-type-id="text-editor"> <state vertical-scroll-proportion="0.0"> - <caret line="593" column="6" selection-start-line="593" selection-start-column="6" selection-end-line="593" selection-end-column="6" /> + <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/pyramid/tests/test_fielddata.py"> + <entry file="file://$PROJECT_DIR$/../Script-Vault/scripts - Alt/collaborations/result.pickle"> <provider selected="true" editor-type-id="text-editor"> <state vertical-scroll-proportion="0.0"> - <caret line="118" column="0" selection-start-line="118" selection-start-column="0" selection-end-line="118" selection-end-column="0" /> + <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/pyramid/tests/test_phasemapper.py"> + <entry file="file://$PROJECT_DIR$/../Script-Vault/scripts - Alt/collaborations/rueffner_file.py"> <provider selected="true" editor-type-id="text-editor"> <state vertical-scroll-proportion="0.0"> - <caret line="14" column="0" selection-start-line="14" selection-start-column="0" selection-end-line="14" selection-end-column="0" /> + <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/pyramid/phasemapper.py"> + <entry file="file://$PROJECT_DIR$/../Script-Vault/scripts - Alt/collaborations/vtk_conversion_nanowire_full.py"> <provider selected="true" editor-type-id="text-editor"> <state vertical-scroll-proportion="0.0"> - <caret line="577" column="99" selection-start-line="577" selection-start-column="99" selection-end-line="577" selection-end-column="99" /> + <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/scripts/phasemap/phasemap_tilt_series.py"> + <entry file="file://$PROJECT_DIR$/../Script-Vault/scripts - Alt/reconstruction/reconstruct_random_pixels.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.2080089"> - <caret line="11" column="51" selection-start-line="11" selection-start-column="51" selection-end-line="11" selection-end-column="51" /> + <state vertical-scroll-proportion="0.0"> + <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/scripts/magdata/magdata_from_vtk.py"> + <entry file="file://$PROJECT_DIR$/../Script-Vault/scripts - Alt/reconstruction/reconstruction_linear_test.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.2080089"> - <caret line="11" column="5" selection-start-line="11" selection-start-column="5" selection-end-line="11" selection-end-column="5" /> + <state vertical-scroll-proportion="0.0"> + <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/scripts/magdata/magdata_from_dat.py"> + <entry file="file://$PROJECT_DIR$/../Script-Vault/scripts - Alt/reconstruction/reconstruction_linear_test_batch.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.7163515"> - <caret line="59" column="5" selection-start-line="59" selection-start-column="5" selection-end-line="59" selection-end-column="5" /> + <state vertical-scroll-proportion="0.0"> + <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/pyramid/dataset.py"> + <entry file="file://$PROJECT_DIR$/../Script-Vault/scripts - Alt/reconstruction/reconstruction_sparse_cg_singular_values.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0189099"> - <caret line="163" column="29" selection-start-line="163" selection-start-column="29" selection-end-line="163" selection-end-column="29" /> + <state vertical-scroll-proportion="0.0"> + <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/pyramid/reconstruction.py"> + <entry file="file://$PROJECT_DIR$/../Script-Vault/scripts - Alt/test methods/compare_kernels.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.0189099"> - <caret line="51" column="46" selection-start-line="51" selection-start-column="46" selection-end-line="51" selection-end-column="46" /> + <state vertical-scroll-proportion="0.0"> + <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/pyramid/costfunction.py"> + <entry file="file://$PROJECT_DIR$/../Script-Vault/scripts - Alt/test methods/compare_methods.py"> <provider selected="true" editor-type-id="text-editor"> <state vertical-scroll-proportion="0.0"> <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> @@ -1169,42 +1429,42 @@ </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/scripts/reconstruction/reconstruction_3d_from_magdata.py"> + <entry file="file://$APPLICATION_HOME_DIR$/helpers/pydev/pydev_run_in_console.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.3546638"> - <caret line="30" column="0" selection-start-line="30" selection-start-column="0" selection-end-line="30" selection-end-column="0" /> + <state vertical-scroll-proportion="0.0"> + <caret line="28" column="0" selection-start-line="28" selection-start-column="0" selection-end-line="28" selection-end-column="0" /> <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/../Publications/tilt_series.py"> + <entry file="file://$PROJECT_DIR$/../HyperSpy/hyperspy/io.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.6496746"> - <caret line="38" column="36" selection-start-line="38" selection-start-column="36" selection-end-line="38" selection-end-column="36" /> + <state vertical-scroll-proportion="0.33294255"> + <caret line="343" column="0" selection-start-line="343" selection-start-column="0" selection-end-line="343" selection-end-column="0" /> <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/pyramid/fielddata.py"> + <entry file="file://$PROJECT_DIR$/pyramid/phasemap.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.55748373"> - <caret line="330" column="58" selection-start-line="330" selection-start-column="58" selection-end-line="330" selection-end-column="58" /> + <state vertical-scroll-proportion="0.0"> + <caret line="154" column="16" selection-start-line="154" selection-start-column="16" selection-end-line="154" selection-end-column="16" /> <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/pyramid/__init__.py"> + <entry file="file://$PROJECT_DIR$/pyramid/kernel.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.52060735"> - <caret line="90" column="38" selection-start-line="90" selection-start-column="38" selection-end-line="90" selection-end-column="38" /> + <state vertical-scroll-proportion="0.0"> + <caret line="112" column="43" selection-start-line="112" selection-start-column="43" selection-end-line="112" selection-end-column="43" /> <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/pyramid/colormap.py"> + <entry file="file://$PROJECT_DIR$/../Script-Vault/scripts - Alt/test methods/compare_pixel_fields.py"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.11171366"> - <caret line="89" column="28" selection-start-line="89" selection-start-column="26" selection-end-line="89" selection-end-column="28" /> + <state vertical-scroll-proportion="0.37866354"> + <caret line="79" column="31" selection-start-line="79" selection-start-column="31" selection-end-line="79" selection-end-column="31" /> <folding /> </state> </provider> @@ -1212,14 +1472,14 @@ </component> <component name="hg4idea.settings"> <option name="CHECK_INCOMING_OUTGOING" value="true" /> - <option name="RECENT_HG_ROOT_PATH" value="$PROJECT_DIR$" /> + <option name="RECENT_HG_ROOT_PATH" value="$PROJECT_DIR$/../Script-Vault" /> <option name="ROOT_SYNC" value="DONT_SYNC" /> </component> <component name="masterDetails"> <states> <state key="ScopeChooserConfigurable.UI"> <settings> - <last-edited>*.c</last-edited> + <last-edited>gui</last-edited> <splitter-proportions> <option name="proportions"> <list> @@ -1230,6 +1490,8 @@ <order> <scope name="__init__" /> <scope name="*.c" /> + <scope name="scripts" /> + <scope name="gui" /> </order> </settings> </state> diff --git a/pyramid/__init__.py b/pyramid/__init__.py index 2c8ec1d833c00d80b73f31da9f7337fb0f7e4e0e..d75f904ee5e276bfb608bb5142d37a14049fc6ea 100644 --- a/pyramid/__init__.py +++ b/pyramid/__init__.py @@ -66,12 +66,14 @@ from . import dataset from .dataset import * from . import diagnostics from .diagnostics import * +from . import fieldconverter +from .fieldconverter import * +from . import fielddata +from .fielddata import * from . import forwardmodel from .forwardmodel import * from . import kernel from .kernel import * -from . import fielddata -from .fielddata import * from . import phasemap from .phasemap import * from . import phasemapper diff --git a/pyramid/dataset.py b/pyramid/dataset.py index 34501da6d74fade3115976148303a0c68c628f7a..1c55c8356cf0b836430f310a858d59d458bf2f4f 100644 --- a/pyramid/dataset.py +++ b/pyramid/dataset.py @@ -8,15 +8,15 @@ and additional data like corresponding projectors.""" import logging from numbers import Number +from pyramid.kernel import Kernel +from pyramid.phasemap import PhaseMap +from pyramid.phasemapper import PhaseMapperRDFC +from pyramid.projector import Projector + import matplotlib.pyplot as plt import numpy as np from scipy import sparse -from .kernel import Kernel -from .phasemap import PhaseMap -from .phasemapper import PhaseMapperRDFC -from .projector import Projector - __all__ = ['DataSet'] diff --git a/pyramid/diagnostics.py b/pyramid/diagnostics.py index eb0bb7a10916b94d65acf385a35143ff4014c57e..df1f72d3f66158ebf3d2d2ce6b7f05b0a893dacd 100644 --- a/pyramid/diagnostics.py +++ b/pyramid/diagnostics.py @@ -7,13 +7,14 @@ specified costfunction for a fixed magnetization distribution.""" import logging +from pyramid import fft +from pyramid.fielddata import VectorData +from pyramid.phasemap import PhaseMap + import matplotlib.pyplot as plt import numpy as np import jutil -from pyramid import fft -from pyramid.fielddata import VectorData -from pyramid.phasemap import PhaseMap __all__ = ['Diagnostics'] diff --git a/pyramid/fielddata.py b/pyramid/fielddata.py index 4301d1f785d744c8ff7a571a333e80e7912d5a1a..af6881e2331eb0f2998feca4c6b33a8227835ed0 100644 --- a/pyramid/fielddata.py +++ b/pyramid/fielddata.py @@ -6,6 +6,11 @@ from __future__ import division +from scipy.ndimage.interpolation import zoom + +from pyramid import fft +from pyramid.colormap import DirectionalColormap + import logging import os from abc import ABCMeta, abstractmethod @@ -14,10 +19,6 @@ from numbers import Number import numpy as np from matplotlib import pyplot as plt from matplotlib.ticker import MaxNLocator -from scipy.ndimage.interpolation import zoom - -from pyramid import fft -from pyramid.colormap import DirectionalColormap _log = logging.getLogger(__name__) try: # Try importing HyperSpy: @@ -123,20 +124,20 @@ class FieldData(object): def __neg__(self): # -self self._log.debug('Calling __neg__') - return VectorData(self.a, -self.field) + return self.__class__(self.a, -self.field) def __add__(self, other): # self + other self._log.debug('Calling __add__') assert isinstance(other, (FieldData, Number)), \ 'Only FieldData objects and scalar numbers (as offsets) can be added/subtracted!' - if isinstance(other, FieldData): - self._log.debug('Adding two VectorData objects') + if isinstance(other, Number): # other is a Number + self._log.debug('Adding an offset') + return self.__class__(self.a, self.field + other) + elif isinstance(other, FieldData): + self._log.debug('Adding two FieldData objects') assert other.a == self.a, 'Added phase has to have the same grid spacing!' assert other.shape == self.shape, 'Added field has to have the same dimensions!' - return self.__init__(self.a, self.field + other.field) - else: # other is a Number - self._log.debug('Adding an offset') - return self.__init__(self.a, self.field + other) + return self.__class__(self.a, self.field + other.field) def __sub__(self, other): # self - other self._log.debug('Calling __sub__') @@ -145,7 +146,7 @@ class FieldData(object): def __mul__(self, other): # self * other self._log.debug('Calling __mul__') assert isinstance(other, Number), 'FieldData objects can only be multiplied by numbers!' - return VectorData(self.a, other * self.field) + return self.__class__(self.a, other * self.field) def __radd__(self, other): # other + self self._log.debug('Calling __radd__') @@ -181,7 +182,7 @@ class FieldData(object): """ self._log.debug('Calling copy') - return self.__init__(self.a, self.field.copy()) + return self.__class__(self.a, self.field.copy()) def get_mask(self, threshold=0): """Mask all pixels where the amplitude of the field lies above `threshold`. @@ -228,7 +229,6 @@ class FieldData(object): mlab.axes(plot) mlab.title(title, height=0.95, size=0.35) mlab.orientation_axes() - # mlab.show() return plot @abstractmethod @@ -327,7 +327,7 @@ class FieldData(object): pass @abstractmethod - def save_to_hdf5(self, filename): + def save_to_hdf5(self, filename, *args, **kwargs): """Save field data in a file with HyperSpys HDF5-format. Parameters @@ -709,7 +709,7 @@ class VectorData(FieldData): a = signal.axes_manager[0].scale return cls(a, field) - def save_to_hdf5(self, filename='vecdata.hdf5'): + def save_to_hdf5(self, filename='vecdata.hdf5', *args, **kwargs): """Save vector field data in a file with HyperSpys HDF5-format. Parameters @@ -732,7 +732,7 @@ class VectorData(FieldData): os.makedirs(directory) filename = os.path.join(directory, filename) # Save data to file: - self.to_signal().save(filename) + self.to_signal().save(filename, *args, **kwargs) @classmethod def load_from_hdf5(cls, filename): @@ -1221,7 +1221,7 @@ class ScalarData(FieldData): a = signal.axes_manager[0].scale return cls(a, field) - def save_to_hdf5(self, filename='scaldata.hdf5'): + def save_to_hdf5(self, filename='scaldata.hdf5', *args, **kwargs): """Save field data in a file with HyperSpys HDF5-format. Parameters diff --git a/pyramid/kernel.py b/pyramid/kernel.py index 6c9c7ae7593391406f7824abf5ff805d612abe4f..1d5a17f0dd9ac84392f45cd219f5ac08d6c67ce8 100644 --- a/pyramid/kernel.py +++ b/pyramid/kernel.py @@ -130,8 +130,8 @@ class Kernel(object): B = np.arctan(n / m) return n * A - 2 * n + 2 * m * B - return 0.5 * (_F_a(n - 0.5, m - 0.5) - _F_a(n + 0.5, m - 0.5) - - _F_a(n - 0.5, m + 0.5) + _F_a(n + 0.5, m + 0.5)) + return 0.5 * (_F_a(m - 0.5, n - 0.5) - _F_a(m + 0.5, n - 0.5) - + _F_a(m - 0.5, n + 0.5) + _F_a(m + 0.5, n + 0.5)) def print_info(self): """Print information about the kernel. diff --git a/pyramid/phasemap.py b/pyramid/phasemap.py index b1bc70afdb73d1b574968c9a2a3f542bd84b13d2..5cd87598b900f5d1d2366a7f6a2e9b2596c3dfe7 100644 --- a/pyramid/phasemap.py +++ b/pyramid/phasemap.py @@ -8,6 +8,8 @@ import logging import os from numbers import Number +from pyramid.colormap import DirectionalColormap, TransparentColormap + import matplotlib.pyplot as plt import numpy as np from PIL import Image @@ -16,8 +18,6 @@ from matplotlib.ticker import MaxNLocator, FuncFormatter from mpl_toolkits.mplot3d import Axes3D from scipy.ndimage.interpolation import zoom -from pyramid.colormap import DirectionalColormap, TransparentColormap - _log = logging.getLogger(__name__) try: # Try importing HyperSpy: import hyperspy.api as hs @@ -468,7 +468,7 @@ class PhaseMap(object): confidence = None return cls(a, phase, mask, confidence, unit) - def save_to_hdf5(self, filename='phasemap.hdf5'): + def save_to_hdf5(self, filename='phasemap.hdf5', *args, **kwargs): """Save magnetization data in a file with HyperSpys HDF5-format. Parameters @@ -491,7 +491,7 @@ class PhaseMap(object): os.makedirs(directory) filename = os.path.join(directory, filename) # Save data to file: - self.to_signal().save(filename) + self.to_signal().save(filename, *args, **kwargs) @classmethod def load_from_hdf5(cls, filename): diff --git a/pyramid/projector.py b/pyramid/projector.py index 7c6e06515b70d827c1af66b8095520063b9c8fe1..986c18f962e140d4d8b38125091fc8cc85953def 100644 --- a/pyramid/projector.py +++ b/pyramid/projector.py @@ -16,7 +16,7 @@ from numpy import pi from scipy.sparse import coo_matrix, csr_matrix import pyramid.fft as fft -from pyramid.fielddata import FieldData, VectorData, ScalarData +from pyramid.fielddata import VectorData, ScalarData from pyramid.quaternion import Quaternion __all__ = ['RotTiltProjector', 'XTiltProjector', 'YTiltProjector', 'SimpleProjector'] diff --git a/pyramid/reconstruction.py b/pyramid/reconstruction.py index 592cb4072a4c0a7157492315fba2e5d00f85d6e9..8fe34f1862749fca4ec595e05e0609a6cdaf6390 100644 --- a/pyramid/reconstruction.py +++ b/pyramid/reconstruction.py @@ -4,11 +4,11 @@ # """Reconstruct magnetic distributions from given phasemaps. -This module reconstructs 3-dimensional magnetic distributions (as :class:`~pyramid.magdata.VectorData` -objects) from a given set of phase maps (represented by :class:`~pyramid.phasemap.PhaseMap` -objects) by using several model based reconstruction algorithms which use the forward model -provided by :mod:`~pyramid.projector` and :mod:`~pyramid.phasemapper` and a priori knowledge of -the distribution. +This module reconstructs 3-dimensional magnetic distributions (as +:class:`~pyramid.magdata.VectorData` objects) from a given set of phase maps (represented by +:class:`~pyramid.phasemap.PhaseMap` objects) by using several model based reconstruction algorithms + which use the forward model provided by :mod:`~pyramid.projector` and :mod:`~pyramid.phasemapper` + and a priori knowledge of the distribution. """ diff --git a/pyramid/version.py b/pyramid/version.py index f7b63cf1674f8622537197726dcdaa5a1cc917cc..e047f287248354ed17d57fd98906adc2637a80a8 100644 --- a/pyramid/version.py +++ b/pyramid/version.py @@ -1,4 +1,4 @@ # -*- coding: utf-8 -*- -"""This file is generated automatically by the Pyramid `setup.py`""" +"""This file is generated automatically by the Pyramid `setup.pr`""" version = '0.1.0-dev' hg_revision = 'a7afcc233730+' diff --git a/scripts/gui/mag_slicer.py b/scripts/gui/mag_slicer.py index 52a1503630a04ab0784b016b59491e4476838798..e0a46f610a50acbb312f83334cfe2c826d6c2ae6 100644 --- a/scripts/gui/mag_slicer.py +++ b/scripts/gui/mag_slicer.py @@ -1,19 +1,18 @@ # -*- coding: utf-8 -*- - # Form implementation generated from reading ui file 'mag_slicer2.ui' # # Created: Sun Aug 31 20:39:52 2014 # by: PyQt4 UI code generator 4.9.6 # # WARNING! All changes made in this file will be lost! - +"""GUI for slicing 3D magnetization distributions.""" import os import sys import pyramid -from pyramid.kernel import Kernel from pyramid.fielddata import VectorData +from pyramid.kernel import Kernel from pyramid.phasemapper import PhaseMapperRDFC from pyramid.projector import SimpleProjector @@ -29,6 +28,7 @@ except AttributeError: try: _encoding = QtGui.QApplication.UnicodeUTF8 + def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, disambig, _encoding) @@ -205,7 +205,7 @@ class UI_MagSlicerMain(QtGui.QWidget): self.projector = SimpleProjector(self.mag_data.dim, axis=self.mode) self.spinBoxSlice.setMaximum(length) self.scrollBarSlice.setMaximum(length) - self.spinBoxSlice.setValue(int(length/2.)) + self.spinBoxSlice.setValue(int(length / 2.)) self.update_slice() self.phase_mapper = PhaseMapperRDFC(Kernel(self.mag_data.a, self.projector.dim_uv)) self.phase_map = self.phase_mapper(self.projector(self.mag_data)) diff --git a/scripts/gui/phasemap_creator.py b/scripts/gui/phasemap_creator.py index 340f09d55c2f823fae8e5cb25cd040efc68126f9..9871cd63c2ec05b0180e3af025f238a97c4f5a8f 100644 --- a/scripts/gui/phasemap_creator.py +++ b/scripts/gui/phasemap_creator.py @@ -6,21 +6,19 @@ # by: PyQt4 UI code generator 4.9.6 # # WARNING! All changes made in this file will be lost! - +"""GUI for setting up PhasMaps from existing data in different formats.""" import os import sys -import numpy as np - -from PyQt4 import QtCore, QtGui +import hyperspy.api as hs -from matplotlibwidget import MatplotlibWidget - -from PIL import Image from pyramid import PhaseMap -import ercpy +import numpy as np +from PIL import Image +from PyQt4 import QtCore, QtGui +from matplotlibwidget import MatplotlibWidget try: _fromUtf8 = QtCore.QString.fromUtf8 @@ -31,6 +29,7 @@ except AttributeError: try: _encoding = QtGui.QApplication.UnicodeUTF8 + def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, disambig, _encoding) except AttributeError: @@ -202,22 +201,19 @@ class UI_PhaseMapCreatorMain(QtGui.QWidget): def update_mask(self): if self.mask_loaded: threshold = self.doubleSpinBox_thres.value() - mask_img = Image.fromarray(self.emd['mask']) - mask = np.asarray(mask_img.resize(reversed(self.emd['phase'].shape))) + mask_img = Image.fromarray(self.raw_mask) + mask = np.asarray(mask_img.resize(list(reversed(self.phase_map.dim_uv)))) self.phase_map.mask = np.where(mask >= threshold, True, False) self.update_phasemap() def load_phase(self): try: self.phase_path = QtGui.QFileDialog.getOpenFileName(self, 'Load Phase', self.dir) - self.emd = ercpy.EMD() - self.emd.add_signal_from_file(self.phase_path, name='phase') + self.phase_map = PhaseMap.from_signal(hs.load(self.phase_path)) except ValueError: return # Abort if no phase_path is selected! - if self.emd.signals['phase'].axes_manager[0].scale != 1.: - self.doubleSpinBox_a.setValue(self.emd.signals['phase'].axes_manager[0].scale) + self.doubleSpinBox_a.setValue(self.phase_map.a) self.dir = os.path.join(os.path.dirname(self.phase_path)) - self.phase_map = PhaseMap(self.doubleSpinBox_a.value(), self.emd['phase']) self.mplwidget.axes.set_visible(True) self.mplwidget.axes.set_visible(True) self.mplwidget.axes.set_visible(True) @@ -238,21 +234,21 @@ class UI_PhaseMapCreatorMain(QtGui.QWidget): def load_mask(self): try: mask_path = QtGui.QFileDialog.getOpenFileName(self, 'Load Mask', self.dir) - self.emd.add_signal_from_file(mask_path, name='mask') + self.raw_mask = hs.load(mask_path).data except ValueError: return # Abort if no mask_path is selected! - mask_min = self.emd['mask'].min() - mask_max = self.emd['mask'].max() + mask_min = self.raw_mask.min() + mask_max = self.raw_mask.max() self.horizontalScrollBar.setEnabled(True) self.horizontalScrollBar.setMinimum(mask_min) self.horizontalScrollBar.setMaximum(mask_max) - self.horizontalScrollBar.setSingleStep((mask_max-mask_min)/255.) - self.horizontalScrollBar.setValue((mask_max-mask_min)/2.) + self.horizontalScrollBar.setSingleStep((mask_max - mask_min) / 255.) + self.horizontalScrollBar.setValue((mask_max - mask_min) / 2.) self.doubleSpinBox_thres.setEnabled(True) self.doubleSpinBox_thres.setMinimum(mask_min) self.doubleSpinBox_thres.setMaximum(mask_max) - self.doubleSpinBox_thres.setSingleStep((mask_max-mask_min)/255.) - self.doubleSpinBox_thres.setValue((mask_max-mask_min)/2.) + self.doubleSpinBox_thres.setSingleStep((mask_max - mask_min) / 255.) + self.doubleSpinBox_thres.setValue((mask_max - mask_min) / 2.) self.mask_loaded = True self.update_mask() @@ -261,26 +257,23 @@ class UI_PhaseMapCreatorMain(QtGui.QWidget): conf_path = QtGui.QFileDialog.getOpenFileName(self, 'Load Confidence', self.dir) except ValueError: return # Abort if no conf_path is selected! - self.emd.add_signal_from_file(conf_path, name='confidence') - confidence = self.emd['confidence'] / self.emd['confidence'].max() - confidence = np.asarray(Image.fromarray(confidence).resize(self.emd['phase'].shape)) + confidence = hs.load(conf_path).data + confidence /= confidence.max() + confidence = np.asarray(Image.fromarray(confidence).resize(self.phase_map.dim_uv)) self.phase_map.confidence = confidence self.update_phasemap() def export(self): try: export_name = os.path.splitext(os.path.basename(self.phase_path))[0] - export_default = os.path.join(self.dir, 'phasemap_gui_{}.nc'.format(export_name)) + export_default = os.path.join(self.dir, 'phasemap_gui_{}.hdf5'.format(export_name)) export_path = QtGui.QFileDialog.getSaveFileName(self, 'Export PhaseMap', - export_default, - 'EMD/NetCDF4 (*.emd *.nc)') - if export_path.endswith('.nc'): - self.phase_map.save_to_netcdf4(export_path) - elif export_path.endswith('.emd'): - self.emd.save_to_emd(export_path) + export_default, 'HDF5 (*.hdf5)') + self.phase_map.to_signal().save(export_path, overwrite=True) except ValueError: return # Abort if no export_path is selected! + if __name__ == '__main__': app = QtGui.QApplication(sys.argv) widget = UI_PhaseMapCreatorMain() diff --git a/scripts/magdata/magcreator/create_alternating_filaments.py b/scripts/magdata/magcreator/create_alternating_filaments.py index 60a906849747f6b14039ad263823f81963570d0f..83ea3485c065d89ef9a20c654d6131cbfa779ad6 100644 --- a/scripts/magdata/magcreator/create_alternating_filaments.py +++ b/scripts/magdata/magcreator/create_alternating_filaments.py @@ -2,29 +2,28 @@ # -*- coding: utf-8 -*- """Create magnetic distribution of alternating filaments.""" +import logging.config import numpy as np -import pyramid as py -import logging.config +import pyramid as pr -logging.config.fileConfig(py.LOGGING_CONFIG, disable_existing_loggers=False) +logging.config.fileConfig(pr.LOGGING_CONFIG, disable_existing_loggers=False) # Parameters: dim = (1, 21, 21) a = 1.0 # in nm -phi = np.pi/2 -theta = np.pi/2 # in rad -magnitude = 1 +phi = np.pi / 2 +theta = np.pi / 2 # in rad spacing = 5 -filename = 'magdata_mc_alternating_filaments_spacing={}.nc'.format(spacing) +filename = 'magdata_mc_alternating_filaments_spacing={}.hdf5'.format(spacing) # Create and save VectorData object: -mag_data = py.VectorData(a, np.zeros((3,) + dim)) -count = int((dim[1]-1) / spacing) + 1 +mag_data = pr.VectorData(a, np.zeros((3,) + dim)) +count = int((dim[1] - 1) / spacing) + 1 for i in range(count): pos = i * spacing - mag_shape = py.magcreator.Shapes.filament(dim, (0, pos)) - mag_data += py.VectorData(a, py.magcreator.create_mag_dist_homog(mag_shape, phi)) + mag_shape = pr.magcreator.Shapes.filament(dim, (0, pos)) + mag_data += pr.VectorData(a, pr.magcreator.create_mag_dist_homog(mag_shape, phi)) phi *= -1 # Switch the angle -mag_data.save_to_netcdf4(filename) +mag_data.save_to_hdf5(filename, overwrite=True) diff --git a/scripts/magdata/magcreator/create_array_sphere_disc_slab.py b/scripts/magdata/magcreator/create_array_sphere_disc_slab.py index 18d71e401dd9b2fda46d4dc6cf69e881a87dd5cc..726cf6045bc029bec01351eb98d97b74837fedb7 100644 --- a/scripts/magdata/magcreator/create_array_sphere_disc_slab.py +++ b/scripts/magdata/magcreator/create_array_sphere_disc_slab.py @@ -6,31 +6,31 @@ import logging.config import numpy as np -import pyramid as py +import pyramid as pr -logging.config.fileConfig(py.LOGGING_CONFIG, disable_existing_loggers=False) +logging.config.fileConfig(pr.LOGGING_CONFIG, disable_existing_loggers=False) # Parameters: dim = (64, 128, 128) a = 10.0 # in nm -filename = 'magdata_mc_array_sphere_disc_slab.nc' +filename = 'magdata_mc_array_sphere_disc_slab.hdf5' # Slab: center = (32, 32, 32) # in px (z, y, x), index starts with 0! width = (48, 48, 48) # in px (z, y, x) -mag_shape_slab = py.magcreator.Shapes.slab(dim, center, width) +mag_shape_slab = pr.magcreator.Shapes.slab(dim, center, width) # Disc: center = (32, 32, 96) # in px (z, y, x), index starts with 0! radius = 24 # in px height = 24 # in px -mag_shape_disc = py.magcreator.Shapes.disc(dim, center, radius, height) +mag_shape_disc = pr.magcreator.Shapes.disc(dim, center, radius, height) # Sphere: center = (32, 96, 64) # in px (z, y, x), index starts with 0! radius = 24 # in px -mag_shape_sphere = py.magcreator.Shapes.sphere(dim, center, radius) +mag_shape_sphere = pr.magcreator.Shapes.sphere(dim, center, radius) # Create and save VectorData object: -mag_data = py.VectorData(a, py.magcreator.create_mag_dist_homog(mag_shape_slab, np.pi / 4)) -mag_data += py.VectorData(a, py.magcreator.create_mag_dist_homog(mag_shape_disc, np.pi / 2)) -mag_data += py.VectorData(a, py.magcreator.create_mag_dist_homog(mag_shape_sphere, np.pi)) -mag_data.save_to_hdf5(filename) +mag_data = pr.VectorData(a, pr.magcreator.create_mag_dist_homog(mag_shape_slab, np.pi / 4)) +mag_data += pr.VectorData(a, pr.magcreator.create_mag_dist_homog(mag_shape_disc, np.pi / 2)) +mag_data += pr.VectorData(a, pr.magcreator.create_mag_dist_homog(mag_shape_sphere, np.pi)) +mag_data.save_to_hdf5(filename, overwrite=True) diff --git a/scripts/magdata/magcreator/create_core_shell_disc.py b/scripts/magdata/magcreator/create_core_shell_disc.py index b28c4bfb86f109f0fb608542751047ec87c3f395..d11be43191ffc087d53120fb6e5a67594906bd56 100644 --- a/scripts/magdata/magcreator/create_core_shell_disc.py +++ b/scripts/magdata/magcreator/create_core_shell_disc.py @@ -2,29 +2,29 @@ # -*- coding: utf-8 -*- """Create magnetic core shell disc.""" +import logging.config import numpy as np -import pyramid as py -import logging.config +import pyramid as pr -logging.config.fileConfig(py.LOGGING_CONFIG, disable_existing_loggers=False) +logging.config.fileConfig(pr.LOGGING_CONFIG, disable_existing_loggers=False) # Parameters: dim = (32, 32, 32) a = 1.0 # in nm -center = (dim[0]//2-0.5, dim[1]//2-0.5, dim[2]//2-0.5) -radius_core = dim[1]//8 -radius_shell = dim[1]//4 -height = dim[0]//2 -filename = 'magdata_mc_core_shell_disc.nc' +center = (dim[0] // 2 - 0.5, dim[1] // 2 - 0.5, dim[2] // 2 - 0.5) +radius_core = dim[1] // 8 +radius_shell = dim[1] // 4 +height = dim[0] // 2 +filename = 'magdata_mc_core_shell_disc.hdf5' # Magnetic shape: -mag_shape_core = py.magcreator.Shapes.disc(dim, center, radius_core, height) -mag_shape_outer = py.magcreator.Shapes.disc(dim, center, radius_shell, height) +mag_shape_core = pr.magcreator.Shapes.disc(dim, center, radius_core, height) +mag_shape_outer = pr.magcreator.Shapes.disc(dim, center, radius_shell, height) mag_shape_shell = np.logical_xor(mag_shape_outer, mag_shape_core) # Create and save VectorData object: -mag_data = py.VectorData(a, py.magcreator.create_mag_dist_vortex(mag_shape_shell, amplitude=0.75)) -mag_data += py.VectorData(a, py.magcreator.create_mag_dist_homog(mag_shape_core, phi=0, theta=0)) -mag_data.save_to_netcdf4(filename) +mag_data = pr.VectorData(a, pr.magcreator.create_mag_dist_vortex(mag_shape_shell, amplitude=0.75)) +mag_data += pr.VectorData(a, pr.magcreator.create_mag_dist_homog(mag_shape_core, phi=0, theta=0)) +mag_data.save_to_hdf5(filename, overwrite=True) diff --git a/scripts/magdata/magcreator/create_core_shell_sphere.py b/scripts/magdata/magcreator/create_core_shell_sphere.py index 64b3dea2683b0ea33c81e8660aeb1b49173b9bd0..70354cdc9242499a35ebd102ce64fa65ec4f9720 100644 --- a/scripts/magdata/magcreator/create_core_shell_sphere.py +++ b/scripts/magdata/magcreator/create_core_shell_sphere.py @@ -2,29 +2,29 @@ # -*- coding: utf-8 -*- """Create magnetic core shell sphere.""" +import logging.config import numpy as np -import pyramid as py -import logging.config +import pyramid as pr -logging.config.fileConfig(py.LOGGING_CONFIG, disable_existing_loggers=False) +logging.config.fileConfig(pr.LOGGING_CONFIG, disable_existing_loggers=False) # Parameters: dim = (32, 32, 32) a = 1.0 # in nm -center = (dim[0]//2-0.5, dim[1]//2-0.5, dim[2]//2-0.5) -radius_core = dim[1]//8 -radius_shell = dim[1]//4 -filename = 'magdata_mc_core_shell_sphere.nc' +center = (dim[0] // 2 - 0.5, dim[1] // 2 - 0.5, dim[2] // 2 - 0.5) +radius_core = dim[1] // 8 +radius_shell = dim[1] // 4 +filename = 'magdata_mc_core_shell_sphere.hdf5' # Magnetic shape: -mag_shape_sphere = py.magcreator.Shapes.sphere(dim, center, radius_shell) -mag_shape_disc = py.magcreator.Shapes.disc(dim, center, radius_core, height=dim[0]) +mag_shape_sphere = pr.magcreator.Shapes.sphere(dim, center, radius_shell) +mag_shape_disc = pr.magcreator.Shapes.disc(dim, center, radius_core, height=dim[0]) mag_shape_core = np.logical_and(mag_shape_sphere, mag_shape_disc) mag_shape_shell = np.logical_and(mag_shape_sphere, np.logical_not(mag_shape_core)) # Create and save VectorData object: -mag_data = py.VectorData(a, py.magcreator.create_mag_dist_vortex(mag_shape_shell, amplitude=0.75)) -mag_data += py.VectorData(a, py.magcreator.create_mag_dist_homog(mag_shape_core, phi=0, theta=0)) -mag_data.save_to_netcdf4(filename) +mag_data = pr.VectorData(a, pr.magcreator.create_mag_dist_vortex(mag_shape_shell, amplitude=0.75)) +mag_data += pr.VectorData(a, pr.magcreator.create_mag_dist_homog(mag_shape_core, phi=0, theta=0)) +mag_data.save_to_hdf5(filename, overwrite=True) diff --git a/scripts/magdata/magcreator/create_flat_homog_slab.py b/scripts/magdata/magcreator/create_flat_homog_slab.py new file mode 100644 index 0000000000000000000000000000000000000000..1d7e187e6322f89283ccd7dc985eb657ca6a5ce3 --- /dev/null +++ b/scripts/magdata/magcreator/create_flat_homog_slab.py @@ -0,0 +1,35 @@ +#! python +# -*- coding: utf-8 -*- +"""Create vortex disc magnetization distribution.""" + +import logging.config + +import numpy as np + +import pyramid as pr + +logging.config.fileConfig(pr.LOGGING_CONFIG, disable_existing_loggers=False) + +# Parameters: +dim = (1, 512, 512) +a = 1.0 # in nm +axis = 'z' +amplitude = 1 +filename = 'magdata_mc_flat_homog_slab.hdf5' +rotation = np.pi / 4 +tilt = 0 + +# Magnetic shape: +center_1 = (0, dim[1] // 2 - 0.5 + 40, dim[2] // 2 - 0.5) +center_2 = (0, dim[1] // 2 - 0.5 - 40, dim[2] // 2 - 0.5) +width = (1, 80, 80) # in px +mag_shape_1 = pr.magcreator.Shapes.slab(dim, center_1, width) +mag_shape_2 = pr.magcreator.Shapes.slab(dim, center_2, width) + +# Create and save VectorData object: +mag = pr.magcreator.create_mag_dist_homog(mag_shape_1, phi=7 / 12. * np.pi, amplitude=amplitude) +mag += pr.magcreator.create_mag_dist_homog(mag_shape_2, phi=1 / 3. * np.pi, amplitude=amplitude) +mag_data = pr.VectorData(a, mag) +projector = pr.RotTiltProjector(mag_data.dim, rotation, tilt) +mag_proj = projector(mag_data) +mag_proj.save_to_hdf5(filename, overwrite=True) diff --git a/scripts/magdata/magcreator/create_flat_vortex_slab.py b/scripts/magdata/magcreator/create_flat_vortex_slab.py new file mode 100644 index 0000000000000000000000000000000000000000..dc5120a41f582aeed9816695ab6532654659d76e --- /dev/null +++ b/scripts/magdata/magcreator/create_flat_vortex_slab.py @@ -0,0 +1,26 @@ +#! python +# -*- coding: utf-8 -*- +"""Create vortex disc magnetization distribution.""" + +import logging.config + +import pyramid as pr + +logging.config.fileConfig(pr.LOGGING_CONFIG, disable_existing_loggers=False) + +# Parameters: +dim = (1, 512, 512) +a = 1.0 # in nm +axis = 'z' +amplitude = 1 +filename = 'magdata_mc_vortex_slab.hdf5' + +# Magnetic shape: +center = (0, dim[1] // 2 - 0.5, dim[2] // 2 - 0.5) +width = (1, 128, 128) # in px +mag_shape = pr.magcreator.Shapes.slab(dim, center, width) + +# Create and save VectorData object: +magnitude = pr.magcreator.create_mag_dist_vortex(mag_shape, center, axis, amplitude) +mag_data = pr.VectorData(a, magnitude) +mag_data.save_to_hdf5(filename, overwrite=True) diff --git a/scripts/magdata/magcreator/create_homog_disc.py b/scripts/magdata/magcreator/create_homog_disc.py index d3f2c284b0456897fea489e5e191f1b517777333..006372f0e8128293a675e9b5070cebafd631d68f 100644 --- a/scripts/magdata/magcreator/create_homog_disc.py +++ b/scripts/magdata/magcreator/create_homog_disc.py @@ -2,28 +2,28 @@ # -*- coding: utf-8 -*- """Create pyramid logo.""" +import logging.config import numpy as np -import pyramid as py -import logging.config +import pyramid as pr -logging.config.fileConfig(py.LOGGING_CONFIG, disable_existing_loggers=False) +logging.config.fileConfig(pr.LOGGING_CONFIG, disable_existing_loggers=False) # Parameters: dim = (32, 32, 32) a = 1.0 # in nm -phi = np.pi/4 # in rad -theta = np.pi/4 # in rad -magnitude = 1 -filename = 'magdata_mc_homog_disc.nc' +phi = np.pi / 4 # in rad +theta = np.pi / 4 # in rad +amplitude = 1 +filename = 'magdata_mc_homog_disc.hdf5' # Magnetic shape: -center = (dim[0]//2-0.5, dim[1]//2-0.5, dim[2]//2-0.5) -radius = dim[2]//4 -height = dim[0]//2 -mag_shape = py.magcreator.Shapes.disc(dim, center, radius, height) +center = (dim[0] // 2 - 0.5, dim[1] // 2 - 0.5, dim[2] // 2 - 0.5) +radius = dim[2] // 4 +height = dim[0] // 2 +mag_shape = pr.magcreator.Shapes.disc(dim, center, radius, height) # Create and save VectorData object: -mag_data = py.VectorData(a, py.magcreator.create_mag_dist_homog(mag_shape, phi, theta, magnitude)) -mag_data.save_to_netcdf4(filename) +mag_data = pr.VectorData(a, pr.magcreator.create_mag_dist_homog(mag_shape, phi, theta, amplitude)) +mag_data.save_to_hdf5(filename, overwrite=True) diff --git a/scripts/magdata/magcreator/create_homog_filament.py b/scripts/magdata/magcreator/create_homog_filament.py index 3ac6eb7a159d3bec735a8eccb1afe1847a5b06be..4debe42748e9c4fabe3d7820feeee777cad0f623 100644 --- a/scripts/magdata/magcreator/create_homog_filament.py +++ b/scripts/magdata/magcreator/create_homog_filament.py @@ -2,26 +2,26 @@ # -*- coding: utf-8 -*- """Create pyramid logo.""" +import logging.config import numpy as np -import pyramid as py -import logging.config +import pyramid as pr -logging.config.fileConfig(py.LOGGING_CONFIG, disable_existing_loggers=False) +logging.config.fileConfig(pr.LOGGING_CONFIG, disable_existing_loggers=False) # Parameters: dim = (1, 32, 32) a = 1.0 # in nm -phi = np.pi/2 # in rad -theta = np.pi/2 # in rad -magnitude = 1 -filename = 'magdata_mc_homog_filament.nc' +phi = np.pi / 2 # in rad +theta = np.pi / 2 # in rad +amplitude = 1 +filename = 'magdata_mc_homog_filament.hdf5' # Magnetic shape: -pos = (0, dim[1]//2) -mag_shape = py.magcreator.Shapes.filament(dim, pos) +pos = (0, dim[1] // 2) +mag_shape = pr.magcreator.Shapes.filament(dim, pos) # Create and save VectorData object: -mag_data = py.VectorData(a, py.magcreator.create_mag_dist_homog(mag_shape, phi, theta, magnitude)) -mag_data.save_to_netcdf4(filename) +mag_data = pr.VectorData(a, pr.magcreator.create_mag_dist_homog(mag_shape, phi, theta, amplitude)) +mag_data.save_to_hdf5(filename, overwrite=True) diff --git a/scripts/magdata/magcreator/create_homog_pixel.py b/scripts/magdata/magcreator/create_homog_pixel.py index 8dd222f03708164d9680899173e4ce0583963ca0..73cb0416ab49c824442aec259e51f885653c646c 100644 --- a/scripts/magdata/magcreator/create_homog_pixel.py +++ b/scripts/magdata/magcreator/create_homog_pixel.py @@ -2,26 +2,26 @@ # -*- coding: utf-8 -*- """Create pyramid logo.""" +import logging.config import numpy as np -import pyramid as py -import logging.config +import pyramid as pr -logging.config.fileConfig(py.LOGGING_CONFIG, disable_existing_loggers=False) +logging.config.fileConfig(pr.LOGGING_CONFIG, disable_existing_loggers=False) # Parameters: dim = (1, 8, 8) a = 1.0 # in nm -phi = np.pi/4 # in rad -theta = np.pi/4 # in rad -magnitude = 1 -filename = 'magdata_mc_pixel.nc' +phi = np.pi / 4 # in rad +theta = np.pi / 4 # in rad +amplitude = 1 +filename = 'magdata_mc_pixel.hdf5' # Magnetic shape: -pixel = (0, dim[1]//4, dim[2]//4) -mag_shape = py.magcreator.Shapes.pixel(dim, pixel) +pixel = (0, dim[1] // 4, dim[2] // 4) +mag_shape = pr.magcreator.Shapes.pixel(dim, pixel) # Create and save VectorData object: -mag_data = py.VectorData(a, py.magcreator.create_mag_dist_homog(mag_shape, phi, theta, magnitude)) -mag_data.save_to_netcdf4(filename) +mag_data = pr.VectorData(a, pr.magcreator.create_mag_dist_homog(mag_shape, phi, theta, amplitude)) +mag_data.save_to_hdf5(filename, overwrite=True) diff --git a/scripts/magdata/magcreator/create_homog_slab.py b/scripts/magdata/magcreator/create_homog_slab.py index 80008b81d79411ce8250acf1573afa025af4df0b..aad46b1bbcbd202243e6e82436621c9f9680b16a 100644 --- a/scripts/magdata/magcreator/create_homog_slab.py +++ b/scripts/magdata/magcreator/create_homog_slab.py @@ -2,27 +2,27 @@ # -*- coding: utf-8 -*- """Create homogeneous slab.""" +import logging.config import numpy as np -import pyramid as py -import logging.config +import pyramid as pr -logging.config.fileConfig(py.LOGGING_CONFIG, disable_existing_loggers=False) +logging.config.fileConfig(pr.LOGGING_CONFIG, disable_existing_loggers=False) # Parameters: dim = (32, 32, 32) a = 1.0 # in nm -phi = np.pi/2 # in rad -theta = np.pi/2 # in rad -magnitude = 1 -filename = 'magdata_mc_homog_slab.nc' +phi = np.pi / 2 # in rad +theta = np.pi / 2 # in rad +amplitude = 1 +filename = 'magdata_mc_homog_slab.hdf5' # Magnetic shape: -center = (dim[0]//2-0.5, dim[1]//2-0.5, dim[2]//2-0.5) -width = (dim[0]//8, dim[1]//2, dim[2]//4) -mag_shape = py.magcreator.Shapes.slab(dim, center, width) +center = (dim[0] // 2 - 0.5, dim[1] // 2 - 0.5, dim[2] // 2 - 0.5) +width = (dim[0] // 8, dim[1] // 2, dim[2] // 4) +mag_shape = pr.magcreator.Shapes.slab(dim, center, width) # Create and save VectorData object: -mag_data = py.VectorData(a, py.magcreator.create_mag_dist_homog(mag_shape, phi, theta, magnitude)) -mag_data.save_to_netcdf4(filename) +mag_data = pr.VectorData(a, pr.magcreator.create_mag_dist_homog(mag_shape, phi, theta, amplitude)) +mag_data.save_to_hdf5(filename, overwrite=True) diff --git a/scripts/magdata/magcreator/create_homog_sphere.py b/scripts/magdata/magcreator/create_homog_sphere.py index 0fd1c7572adda87d8eddf51461504ecfae5c0e59..35f6e56a5f52f517b6169527f0c18a52108ede09 100644 --- a/scripts/magdata/magcreator/create_homog_sphere.py +++ b/scripts/magdata/magcreator/create_homog_sphere.py @@ -2,27 +2,27 @@ # -*- coding: utf-8 -*- """Create pyramid logo.""" +import logging.config import numpy as np -import pyramid as py -import logging.config +import pyramid as pr -logging.config.fileConfig(py.LOGGING_CONFIG, disable_existing_loggers=False) +logging.config.fileConfig(pr.LOGGING_CONFIG, disable_existing_loggers=False) # Parameters: dim = (32, 32, 32) a = 1.0 # in nm -phi = np.pi/4 # in rad -theta = np.pi/2 # in rad -magnitude = 1 -filename = 'magdata_mc_homog_sphere.nc' +phi = np.pi / 4 # in rad +theta = np.pi / 2 # in rad +amplitude = 1 +filename = 'magdata_mc_homog_sphere.hdf5' # Magnetic shape: -center = (dim[0]//2-0.5, dim[1]//2-0.5, dim[2]//2-0.5) -radius = dim[2]//4 # in px -mag_shape = py.magcreator.Shapes.sphere(dim, center, radius) +center = (dim[0] // 2 - 0.5, dim[1] // 2 - 0.5, dim[2] // 2 - 0.5) +radius = dim[2] // 4 # in px +mag_shape = pr.magcreator.Shapes.sphere(dim, center, radius) # Create and save VectorData object: -mag_data = py.VectorData(a, py.magcreator.create_mag_dist_homog(mag_shape, phi, theta, magnitude)) -mag_data.save_to_netcdf4(filename) +mag_data = pr.VectorData(a, pr.magcreator.create_mag_dist_homog(mag_shape, phi, theta, amplitude)) +mag_data.save_to_hdf5(filename, overwrite=True) diff --git a/scripts/magdata/magcreator/create_horseshoe.py b/scripts/magdata/magcreator/create_horseshoe.py new file mode 100644 index 0000000000000000000000000000000000000000..444b9de82a4eb98fe28a7c2e8bb72ae3eb2eeda4 --- /dev/null +++ b/scripts/magdata/magcreator/create_horseshoe.py @@ -0,0 +1,30 @@ +#! python +# -*- coding: utf-8 -*- +"""Create magnetic horseshoe vortex.""" + +import logging.config + +import numpy as np + +import pyramid as pr + +logging.config.fileConfig(pr.LOGGING_CONFIG, disable_existing_loggers=False) + +# Parameters: +dim = (32, 128, 128) +a = 10.0 # in nm +center = (dim[0] // 2 - 0.5, dim[1] // 2 - 0.5, dim[2] // 2 - 0.5) +radius_core = dim[1] // 8 +radius_shell = dim[1] // 4 +height = dim[0] // 2 +filename = 'magdata_mc_horseshoe.hdf5' + +# Magnetic shape: +mag_shape_core = pr.magcreator.Shapes.disc(dim, center, radius_core, height) +mag_shape_outer = pr.magcreator.Shapes.disc(dim, center, radius_shell, height) +mag_shape_horseshoe = np.logical_xor(mag_shape_outer, mag_shape_core) +mag_shape_horseshoe[:, dim[1] // 2:, :] = False + +# Create and save VectorData object: +mag_data = pr.VectorData(a, pr.magcreator.create_mag_dist_vortex(mag_shape_horseshoe)) +mag_data.save_to_hdf5(filename, overwrite=True) diff --git a/scripts/magdata/magcreator/create_paper2_homog_slab.py b/scripts/magdata/magcreator/create_paper2_homog_slab.py deleted file mode 100644 index 35deeca5c6f53b933b2e712a41ad21e6e7018bfc..0000000000000000000000000000000000000000 --- a/scripts/magdata/magcreator/create_paper2_homog_slab.py +++ /dev/null @@ -1,36 +0,0 @@ -#! python -# -*- coding: utf-8 -*- -"""Create vortex disc magnetization distribution.""" - - -import numpy as np -import pyramid as py -import logging.config - - -logging.config.fileConfig(py.LOGGING_CONFIG, disable_existing_loggers=False) - -# Parameters: -dim = (1, 512, 512) -a = 1.0 # in nm -axis = 'z' -magnitude = 1 -filename = 'magdata_mc_paper2_homog_slab_simulated.nc' -rotation = np.pi/4 -tilt = 0 - -# Magnetic shape: -center_1 = (0, dim[1]//2-0.5+40, dim[2]//2-0.5) -center_2 = (0, dim[1]//2-0.5-40, dim[2]//2-0.5) -width = (0, 80, 80) # in px -mag_shape_1 = py.magcreator.Shapes.slab(dim, center_1, width) -mag_shape_2 = py.magcreator.Shapes.slab(dim, center_2, width) - -# Create and save VectorData object: -mag = py.magcreator.create_mag_dist_homog(mag_shape_1, phi=7 / 12. * np.pi, amplitude=magnitude) -mag += py.magcreator.create_mag_dist_homog(mag_shape_2, phi=1 / 3. * np.pi, amplitude=magnitude) -mag_data = py.VectorData(a, mag) -projector = py.RotTiltProjector(mag_data.dim, rotation, tilt) -mag_data = projector(mag_data) -mag_data.save_to_netcdf4(filename) -mag_data.quiver_plot(ar_dens=16) diff --git a/scripts/magdata/magcreator/create_paper2_vortex_slab.py b/scripts/magdata/magcreator/create_paper2_vortex_slab.py deleted file mode 100644 index f7574e55d54542631a96d657c4cc1b2817dba8de..0000000000000000000000000000000000000000 --- a/scripts/magdata/magcreator/create_paper2_vortex_slab.py +++ /dev/null @@ -1,27 +0,0 @@ -#! python -# -*- coding: utf-8 -*- -"""Create vortex disc magnetization distribution.""" - - -import pyramid as py -import logging.config - - -logging.config.fileConfig(py.LOGGING_CONFIG, disable_existing_loggers=False) - -# Parameters: -dim = (1, 512, 512) -a = 1.0 # in nm -axis = 'z' -magnitude = 1 -filename = 'magdata_mc_paper2_vortex_slab_simulated.nc' - -# Magnetic shape: -center = (0, dim[1]//2-0.5, dim[2]//2-0.5) -width = (0, 128, 128) # in px -mag_shape = py.magcreator.Shapes.slab(dim, center, width) - -# Create and save VectorData object: -mag_data = py.VectorData(a, - py.magcreator.create_mag_dist_vortex(mag_shape, center, axis, magnitude)) -mag_data.save_to_netcdf4(filename) diff --git a/scripts/magdata/magcreator/create_pyramid_logo.py b/scripts/magdata/magcreator/create_pyramid_logo.py index 55b6c7c4d147da0959e324d55d359158ff9bd512..51bf1a3793d1a14e88f5b9bff8702b758904e448 100644 --- a/scripts/magdata/magcreator/create_pyramid_logo.py +++ b/scripts/magdata/magcreator/create_pyramid_logo.py @@ -2,32 +2,32 @@ # -*- coding: utf-8 -*- """Create pyramid logo.""" +import logging.config import numpy as np -import pyramid as py -import logging.config +import pyramid as pr -logging.config.fileConfig(py.LOGGING_CONFIG, disable_existing_loggers=False) +logging.config.fileConfig(pr.LOGGING_CONFIG, disable_existing_loggers=False) # Parameters: dim = (1, 256, 256) a = 1.0 # in nm -phi = -np.pi/2 # in rad -theta = np.pi/2 # in rad -magnitude = 1 -filename = 'magdata_mc_pyramid_logo.nc' +phi = -np.pi / 2 # in rad +theta = np.pi / 2 # in rad +amplitude = 1 +filename = 'magdata_mc_pyramid_logo.hdf5' # Magnetic shape: mag_shape = np.zeros(dim) x = range(dim[2]) y = range(dim[1]) xx, yy = np.meshgrid(x, y) -bottom = (yy >= 0.25*dim[1]) -left = (yy <= 0.75/0.5 * dim[1]/dim[2] * xx) +bottom = (yy >= 0.25 * dim[1]) +left = (yy <= 0.75 / 0.5 * dim[1] / dim[2] * xx) right = np.fliplr(left) mag_shape[0, ...] = np.logical_and(np.logical_and(left, right), bottom) # Create and save VectorData object: -mag_data = py.VectorData(a, py.magcreator.create_mag_dist_homog(mag_shape, phi, theta, magnitude)) -mag_data.save_to_netcdf4(filename) +mag_data = pr.VectorData(a, pr.magcreator.create_mag_dist_homog(mag_shape, phi, theta, amplitude)) +mag_data.save_to_hdf5(filename, overwrite=True) diff --git a/scripts/magdata/magcreator/create_random_pixels.py b/scripts/magdata/magcreator/create_random_pixels.py index 7173694708b94dd49cf627be34a012f05a376653..c72a46704609cd8acfc79ad370f45db4dd6ff98a 100644 --- a/scripts/magdata/magcreator/create_random_pixels.py +++ b/scripts/magdata/magcreator/create_random_pixels.py @@ -2,37 +2,37 @@ # -*- coding: utf-8 -*- """Create random magnetic distributions.""" +import logging.config +import random as rnd import numpy as np -import random as rnd -import pyramid as py -import logging.config +import pyramid as pr -logging.config.fileConfig(py.LOGGING_CONFIG, disable_existing_loggers=False) +logging.config.fileConfig(pr.LOGGING_CONFIG, disable_existing_loggers=False) # Parameters: dim = (1, 128, 128) a = 10 # in nm count = 10 rnd.seed(12) -filename = 'magdata_mc_{}_random_pixels.nc'.format(count) +filename = 'magdata_mc_{}_random_pixels.hdf5'.format(count) # Magnetic shape: mag_shape = np.zeros(dim) x = range(dim[2]) y = range(dim[1]) xx, yy = np.meshgrid(x, y) -bottom = (yy >= 0.25*dim[1]) -left = (yy <= 0.75/0.5 * dim[1]/dim[2] * xx) +bottom = (yy >= 0.25 * dim[1]) +left = (yy <= 0.75 / 0.5 * dim[1] / dim[2] * xx) right = np.fliplr(left) mag_shape[0, ...] = np.logical_and(np.logical_and(left, right), bottom) # Create and save VectorData object: -mag_data = py.VectorData(a, np.zeros((3,) + dim)) +mag_data = pr.VectorData(a, np.zeros((3,) + dim)) for i in range(count): pixel = (rnd.randrange(dim[0]), rnd.randrange(dim[1]), rnd.randrange(dim[2])) - mag_shape = py.magcreator.Shapes.pixel(dim, pixel) + mag_shape = pr.magcreator.Shapes.pixel(dim, pixel) phi = 2 * np.pi * rnd.random() - mag_data += py.VectorData(a, py.magcreator.create_mag_dist_homog(mag_shape, phi)) -mag_data.save_to_netcdf4(filename) + mag_data += pr.VectorData(a, pr.magcreator.create_mag_dist_homog(mag_shape, phi)) +mag_data.save_to_hdf5(filename, overwrite=True) diff --git a/scripts/magdata/magcreator/create_random_slabs.py b/scripts/magdata/magcreator/create_random_slabs.py index b68e37477c3105d202947ba1622af99a41db6743..127b1edf5608a47126ea4087490e197f1033aae5 100644 --- a/scripts/magdata/magcreator/create_random_slabs.py +++ b/scripts/magdata/magcreator/create_random_slabs.py @@ -2,14 +2,14 @@ # -*- coding: utf-8 -*- """Create random magnetic distributions.""" +import logging.config +import random as rnd import numpy as np -import random as rnd -import pyramid as py -import logging.config +import pyramid as pr -logging.config.fileConfig(py.LOGGING_CONFIG, disable_existing_loggers=False) +logging.config.fileConfig(pr.LOGGING_CONFIG, disable_existing_loggers=False) # Parameters: dim = (1, 128, 128) @@ -17,26 +17,26 @@ a = 10 # in nm count = 10 w_max = 10 rnd.seed(42) -filename = 'magdata_mc_{}_random_slabs.nc'.format(count) +filename = 'magdata_mc_{}_random_slabs.hdf5'.format(count) # Magnetic shape: mag_shape = np.zeros(dim) x = range(dim[2]) y = range(dim[1]) xx, yy = np.meshgrid(x, y) -bottom = (yy >= 0.25*dim[1]) -left = (yy <= 0.75/0.5 * dim[1]/dim[2] * xx) +bottom = (yy >= 0.25 * dim[1]) +left = (yy <= 0.75 / 0.5 * dim[1] / dim[2] * xx) right = np.fliplr(left) mag_shape[0, ...] = np.logical_and(np.logical_and(left, right), bottom) # Create and save VectorData object: -mag_data = py.VectorData(a, np.zeros((3,) + dim)) +mag_data = pr.VectorData(a, np.zeros((3,) + dim)) for i in range(count): width = (1, rnd.randint(1, w_max), rnd.randint(1, w_max)) - center = (rnd.randrange(int(width[0]/2), dim[0]-int(width[0]/2)), - rnd.randrange(int(width[1]/2), dim[1]-int(width[1]/2)), - rnd.randrange(int(width[2]/2), dim[2]-int(width[2]/2))) - mag_shape = py.magcreator.Shapes.slab(dim, center, width) + center = (rnd.randrange(int(width[0] / 2), dim[0] - int(width[0] / 2)), + rnd.randrange(int(width[1] / 2), dim[1] - int(width[1] / 2)), + rnd.randrange(int(width[2] / 2), dim[2] - int(width[2] / 2))) + mag_shape = pr.magcreator.Shapes.slab(dim, center, width) phi = 2 * np.pi * rnd.random() - mag_data += py.VectorData(a, py.magcreator.create_mag_dist_homog(mag_shape, phi)) -mag_data.save_to_netcdf4(filename) + mag_data += pr.VectorData(a, pr.magcreator.create_mag_dist_homog(mag_shape, phi)) +mag_data.save_to_hdf5(filename, overwrite=True) diff --git a/scripts/magdata/magcreator/create_singularity.py b/scripts/magdata/magcreator/create_singularity.py index cc69368e33380074e42d95c05199e3d32d6c39d9..33534c39aeab397fe6b2df3109199186a1420a8d 100644 --- a/scripts/magdata/magcreator/create_singularity.py +++ b/scripts/magdata/magcreator/create_singularity.py @@ -1,26 +1,24 @@ # -*- coding: utf-8 -*- """magnetic singularity""" +import logging.config import numpy as np -import pyramid as py -import logging.config +import pyramid as pr -logging.config.fileConfig(py.LOGGING_CONFIG, disable_existing_loggers=False) +logging.config.fileConfig(pr.LOGGING_CONFIG, disable_existing_loggers=False) # Parameters: dim = (5, 5, 5) center = (2., 2., 2.) a = 1.0 # in nm -filename = 'magdata_mc_singularity.nc' +filename = 'magdata_mc_singularity.hdf5' -magnitude = np.zeros((3,) + dim) zz, yy, xx = np.indices(dim) -magnitude = np.array((xx-center[2], yy-center[1], zz-center[0])) -magnitude /= np.sqrt((magnitude**2).sum(axis=0)) +magnitude = np.array((xx - center[2], yy - center[1], zz - center[0])) +magnitude /= np.sqrt((magnitude ** 2).sum(axis=0)) # Create and save VectorData object: -mag_data = py.VectorData(a, magnitude) -mag_data.quiver_plot3d(coloring='full angle') -mag_data.save_to_netcdf4(filename) +mag_data = pr.VectorData(a, magnitude) +mag_data.save_to_hdf5(filename, overwrite=True) diff --git a/scripts/magdata/magcreator/create_vortex_disc.py b/scripts/magdata/magcreator/create_vortex_disc.py index 72291dcdf4e8533ab2a95e31bf0bba6a4935fc52..475cc9a52952131c684c38a8591ff9e6551add7c 100644 --- a/scripts/magdata/magcreator/create_vortex_disc.py +++ b/scripts/magdata/magcreator/create_vortex_disc.py @@ -2,27 +2,26 @@ # -*- coding: utf-8 -*- """Create vortex disc magnetization distribution.""" - -import pyramid as py import logging.config +import pyramid as pr -logging.config.fileConfig(py.LOGGING_CONFIG, disable_existing_loggers=False) +logging.config.fileConfig(pr.LOGGING_CONFIG, disable_existing_loggers=False) # Parameters: dim = (64, 64, 64) a = 10.0 # in nm axis = 'x' -magnitude = 1 -filename = 'magdata_mc_vortex_disc_x.nc' +amplitude = 1 +filename = 'magdata_mc_vortex_disc_x.hdf5' # Magnetic shape: -center = (dim[0]//2, dim[1]//2, dim[2]//2) -radius = dim[2]//4 -height = dim[0]//2 -mag_shape = py.magcreator.Shapes.disc(dim, center, radius, height, axis) +center = (dim[0] // 2, dim[1] // 2, dim[2] // 2) +radius = dim[2] // 4 +height = dim[0] // 2 +mag_shape = pr.magcreator.Shapes.disc(dim, center, radius, height, axis) # Create and save VectorData object: -mag_data = py.VectorData(a, - py.magcreator.create_mag_dist_vortex(mag_shape, center, axis, magnitude)) -mag_data.save_to_netcdf4(filename) +magnitude = pr.magcreator.create_mag_dist_vortex(mag_shape, center, axis, amplitude) +mag_data = pr.VectorData(a, magnitude) +mag_data.save_to_hdf5(filename, overwrite=True) diff --git a/scripts/magdata/magcreator/create_vortex_sphere.py b/scripts/magdata/magcreator/create_vortex_sphere.py index 2c2ccee577024f43dbb25114527428d5138b8004..0b545c71dbfaa4c9a5adcb3f92cade1bc1227c9a 100644 --- a/scripts/magdata/magcreator/create_vortex_sphere.py +++ b/scripts/magdata/magcreator/create_vortex_sphere.py @@ -2,26 +2,25 @@ # -*- coding: utf-8 -*- """Create vortex disc magnetization distribution.""" - -import pyramid as py import logging.config +import pyramid as pr -logging.config.fileConfig(py.LOGGING_CONFIG, disable_existing_loggers=False) +logging.config.fileConfig(pr.LOGGING_CONFIG, disable_existing_loggers=False) # Parameters: dim = (32, 32, 32) a = 10.0 # in nm axis = 'z' -magnitude = 1 -filename = 'magdata_mc_vortex_sphere.nc' +amplitude = 1 +filename = 'magdata_mc_vortex_sphere.hdf5' # Magnetic shape: -center = (dim[0]//2-0.5, dim[1]//2-0.5, dim[2]//2-0.5) -radius = dim[2]//4 # in px -mag_shape = py.magcreator.Shapes.sphere(dim, center, radius) +center = (dim[0] // 2 - 0.5, dim[1] // 2 - 0.5, dim[2] // 2 - 0.5) +radius = dim[2] // 4 # in px +mag_shape = pr.magcreator.Shapes.sphere(dim, center, radius) # Create and save VectorData object: -mag_data = py.VectorData(a, - py.magcreator.create_mag_dist_vortex(mag_shape, center, axis, magnitude)) -mag_data.save_to_netcdf4(filename) +magnitude = pr.magcreator.create_mag_dist_vortex(mag_shape, center, axis, amplitude) +mag_data = pr.VectorData(a, magnitude) +mag_data.save_to_hdf5(filename, overwrite=True) diff --git a/scripts/magdata/magdata_from_dat.py b/scripts/magdata/magdata_from_dat.py index e698299cfdb1f8359b6b2c8ebb525741505857ae..e8a290ece8943dbbdfa293afa653b198c317d3fb 100644 --- a/scripts/magdata/magdata_from_dat.py +++ b/scripts/magdata/magdata_from_dat.py @@ -1,12 +1,14 @@ # -*- coding: utf-8 -*- """Create magnetization distributions from fortran sorted txt-files.""" - +import logging.config import os + import numpy as np + import pyramid as py -import logging.config +import matplotlib.pyplot as plt logging.config.fileConfig(py.LOGGING_CONFIG, disable_existing_loggers=False) @@ -15,8 +17,6 @@ filename = 'J=1.D=0.084.H=0.0067.Bobber.dat' scale = 1 ################################################################################################### - -#def func(): path = os.path.join(py.DIR_FILES, 'dat', filename) data = np.genfromtxt(path, dtype=np.float32, delimiter=',', usecols=(0, 1, 2, 3, 4, 5)) x, y, z, xmag, ymag, zmag = data.T @@ -30,39 +30,8 @@ ymag = ymag.reshape(dim).swapaxes(1, 2) zmag = zmag.reshape(dim).swapaxes(1, 2) magnitude = np.array((xmag, ymag, zmag)) mag_data = py.VectorData(a, magnitude) -#mag_data.save_to_netcdf4('magdata_dat_{}'.format(filename.replace('.dat', '.nc'))) +mag_data.save_to_hdf5('magdata_dat_{}'.format(filename.replace('.dat', '.hdf5')), overwrite=True) mag_data.quiver_plot3d(ar_dens=4, coloring='amplitude') mag_data.quiver_plot3d(ar_dens=4, coloring='angle') py.pm(mag_data).display_combined(interpolation='bilinear') - - -#def funci(): -# path = os.path.join(py.DIR_FILES, 'dat', filename) -# with open(path) as f: -# import csv -# reader = csv.reader(f) -# x, y, z, xmag, ymag, zmag = [], [], [], [], [], [] -# for row in reader: -# x.append(int(row[0])) -# y.append(int(row[1])) -# z.append(int(row[2])) -# xmag.append(float(row[3])) -# ymag.append(float(row[4])) -# zmag.append(float(row[5])) -# a = (y[1] - y[0]) * scale -# dim_z = len(np.unique(z)) -# dim_y = len(np.unique(y)) -# dim_x = len(np.unique(x)) -# dim = (dim_z, dim_x, dim_y) # Order of descending variance! -# xmag = np.reshape(xmag, dim).swapaxes(1, 2) -# ymag = np.reshape(ymag, dim).swapaxes(1, 2) -# zmag = np.reshape(zmag, dim).swapaxes(1, 2) -# field = np.array((xmag, ymag, zmag)) -# mag_data = py.VectorData(a, field) -# return mag_data -## mag_data.save_to_netcdf4('magdata_dat_{}'.format(filename.replace('.dat', '.nc'))) -# -#if __name__ == '__main__': -# mag_data = funci() -# -# +plt.show() diff --git a/scripts/magdata/magdata_from_txtfortran.py b/scripts/magdata/magdata_from_txtfortran.py index 6a461cdf76a8a440392bd85b2d8714c9496df900..dc317e11b85dc809f3e3ec36de4cee8bc5df1ab7 100644 --- a/scripts/magdata/magdata_from_txtfortran.py +++ b/scripts/magdata/magdata_from_txtfortran.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- """Create magnetization distributions from fortran sorted txt-files.""" - +import logging.config import os + import numpy as np -import pyramid as py -import logging.config +import pyramid as py logging.config.fileConfig(py.LOGGING_CONFIG, disable_existing_loggers=False) @@ -28,4 +28,5 @@ magnitude = np.array((x_mag, y_mag, z_mag)) # Create and save VectorData object: mag_data = py.VectorData(a, magnitude) -mag_data.save_to_netcdf4('magdata_txtfortran_{}'.format(filename.replace('.txt', '.nc'))) +mag_name = 'magdata_txtfortran_{}'.format(filename.replace('.txt', '.hdf5')) +mag_data.save_to_hdf5(mag_name, overwrite=True) diff --git a/scripts/magdata/magdata_from_vtk.py b/scripts/magdata/magdata_from_vtk.py index d377aa6917219a14e336101accc3ab69ec1ab858..d16a2230fc526fb4e0768224e730ff4c2aa920b4 100644 --- a/scripts/magdata/magdata_from_vtk.py +++ b/scripts/magdata/magdata_from_vtk.py @@ -1,37 +1,67 @@ # -*- coding: utf-8 -*- """Create magnetization distributions from vtk-files.""" +from __future__ import print_function +import logging.config import os -import imp +from time import sleep + +import pyramid as pr + +import matplotlib.pyplot as plt import numpy as np +import vtk from pylab import griddata from scipy.spatial import cKDTree as KDTree -import matplotlib.pyplot as plt -import vtk from tqdm import tqdm -import pyramid as py -import logging.config - -logging.config.fileConfig(py.LOGGING_CONFIG, disable_existing_loggers=False) +logging.config.fileConfig(pr.LOGGING_CONFIG, disable_existing_loggers=False) ################################################################################################### -filename = 'gyroid_p110c333_end_angle_90_45.0.vtk' +filename = 'tube_90x30x35nm.vtk' b_0 = 1. ################################################################################################### -filepath = os.path.join(py.DIR_FILES, 'vtk', filename) -# Load additional points for the z-slices (for non-convex structures): -configname = filename.replace('.vtk', '_addpoints') -configpath = os.path.join(py.DIR_FILES, 'vtk', configname+'.py') -insert_x, insert_y = [], [] -condition = lambda z: False # If no config file is found! -if os.path.isfile(configpath): - config = imp.load_source(configname, configpath) - condition, insert_x, insert_y = config.condition, config.insert_x, config.insert_y - -print 'LOAD VTK-DATA!' + +def enclosing_zero(x, y, nx=30, ny=30): + """ + Construct a grid of points, that are some distance away from points (x, y) + + Parameters + ---------- + x : int + + y : int + + nx: int, optional + + ny: int, optional + + Returns + ------- + zero_points: lists + Two lists for the finer grid in x and y. + + """ + dx = x.ptp() / nx + dy = y.ptp() / ny + xp, yp = np.mgrid[x.min() - 2 * dx:x.max() + 2 * dx:(nx + 2) * 1j, + y.min() - 2 * dy:y.max() + 2 * dy:(ny + 2) * 1j] + xp = xp.ravel() + yp = yp.ravel() + # Use KDTree to answer the question: "which point of set (x, y) is the + # nearest neighbors of those in (xp, yp)" + tree = KDTree(np.c_[x, y]) + dist, j = tree.query(np.c_[xp, yp], k=1) + # Select points sufficiently far away + m = (dist > np.hypot(dx, dy)) + return xp[m], yp[m] + + +filepath = os.path.join(pr.DIR_FILES, 'vtk', filename) + +print('LOAD VTK-DATA!') # Setting up reader: reader = vtk.vtkDataSetReader() reader.SetFileName(filepath) @@ -53,15 +83,14 @@ vector_array = np.zeros(vtk_points.GetSize()) vtk_vectors.ExportToVoidPointer(vector_array) vector_array = np.reshape(vector_array, (-1, 3)) # Combining data: -data = np.hstack((point_array, vector_array)).astype(py.fft.FLOAT) +data = np.hstack((point_array, vector_array)).astype(pr.fft.FLOAT) # Discard unused stuff: del reader, output, vtk_points, vtk_vectors, point_array, vector_array # Scatter plot of all x-y-coordinates axis = plt.figure().add_subplot(1, 1, 1) axis.scatter(data[:, 0], data[:, 1]) -plt.show() -print 'INTERPOLATE ON REGULAR GRID!' +print('INTERPOLATE ON REGULAR GRID!') # Find unique z-slices: z_uniq = np.unique(data[:, 2]) # Determine the grid spacing: @@ -71,86 +100,38 @@ x_min, x_max = data[:, 0].min(), data[:, 0].max() y_min, y_max = data[:, 1].min(), data[:, 1].max() z_min, z_max = data[:, 2].min(), data[:, 2].max() x_diff, y_diff, z_diff = np.ptp(data[:, 0]), np.ptp(data[:, 1]), np.ptp(data[:, 2]) -x_cent, y_cent, z_cent = x_min+x_diff/2., y_min+y_diff/2., z_min+z_diff/2. +x_cent, y_cent, z_cent = x_min + x_diff / 2., y_min + y_diff / 2., z_min + z_diff / 2. # Create regular grid: -x = np.arange(x_cent-x_diff, x_cent+x_diff, a) -y = np.arange(y_cent-y_diff, y_cent+y_diff, a) +x = np.arange(x_cent - x_diff, x_cent + x_diff, a) +y = np.arange(y_cent - y_diff, y_cent + y_diff, a) z = np.arange(z_min, z_max, a) xx, yy = np.meshgrid(x, y) - - -def excluding_mesh(x, y, nx=30, ny=30): - """ - Construct a grid of points, that are some distance away from points (x, - """ - - dx = x.ptp() / nx - dy = y.ptp() / ny - - xp, yp = np.mgrid[x.min()-2*dx:x.max()+2*dx:(nx+2)*1j, - y.min()-2*dy:y.max()+2*dy:(ny+2)*1j] - xp = xp.ravel() - yp = yp.ravel() - - # Use KDTree to answer the question: "which point of set (x,y) is the - # nearest neighbors of those in (xp, yp)" - tree = KDTree(np.c_[x, y]) - dist, j = tree.query(np.c_[xp, yp], k=1) - - # Select points sufficiently far away - m = (dist > np.hypot(dx, dy)) - return xp[m], yp[m] - -## Prepare fake data points -#xp, yp = excluding_mesh(x, y, nx=35, ny=35) -#zp = np.nan + np.zeros_like(xp) -# -## Grid the data plus fake data points -#xi, yi = np.ogrid[-3:3:350j, -3:3:350j] -#zi = griddata((np.r_[x,xp], np.r_[y,yp]), np.r_[z, zp], (xi, yi), -# method='linear') -#plt.imshow(zi) -#plt.show() - - # Create empty field: -magnitude = np.zeros((3, len(z), len(y), len(x)), dtype=py.fft.FLOAT) -print 'Mag Dimensions:', magnitude.shape[1:] - - -#import pdb; pdb.set_trace() +magnitude = np.zeros((3, len(z), len(y), len(x)), dtype=pr.fft.FLOAT) +print('Mag Dimensions:', magnitude.shape[1:]) +sleep(0.5) # Fill field slice per slice: for i, zi in tqdm(enumerate(z), total=len(z)): # Take all points that lie in one z-voxel of the new regular grid into account (use weights!): - z_slice = data[np.abs(data[:, 2]-zi) <= a/2., :] - weights = 1 - np.abs(z_slice[:, 2]-zi)*2/a # If z is regular everywhere, weights are always 1! - + z_slice = data[np.abs(data[:, 2] - zi) <= a / 2., :] + # If z is regular everywhere, weights are always 1: + weights = 1 - np.abs(z_slice[:, 2] - zi) * 2 / a # Prepare fake data points - x_nan, y_nan = excluding_mesh(z_slice[:, 0], z_slice[:, 1], nx=len(x)//10, ny=len(y)//10) - z_nan = np.nan + np.zeros_like(x_nan) - - - if i == 10: - axis = plt.figure().add_subplot(1, 1, 1) - axis.scatter(x_nan, y_nan) - plt.show() - + x_nan, y_nan = enclosing_zero(z_slice[:, 0], z_slice[:, 1], nx=len(x) // 10, ny=len(y) // 10) + z_nan = np.empty_like(x_nan) + z_nan[:] = np.nan grid_x = np.r_[z_slice[:, 0], x_nan] grid_y = np.r_[z_slice[:, 1], y_nan] for j in range(3): # For all 3 components! -# if condition(zi): # use insert point if condition is True! -# grid_x = np.concatenate([z_slice[:, 0], insert_x]) -# grid_y = np.concatenate([z_slice[:, 1], insert_y]) -# grid_z = np.concatenate([weights*z_slice[:, 3+j], np.zeros(len(insert_x))]) -# else: - grid_z = np.r_[weights*z_slice[:, 3+j], z_nan] + grid_z = np.r_[weights * z_slice[:, 3 + j], z_nan] gridded_subdata = griddata(grid_x, grid_y, grid_z, xx, yy) - magnitude[j, i, :, :] = gridded_subdata.filled(fill_value=0).astype(py.fft.FLOAT) + magnitude[j, i, :, :] = gridded_subdata.filled(fill_value=0).astype(pr.fft.FLOAT) + +print('CREATE AND SAVE MAGDATA OBJECT!') # Convert a to nm: a *= 10 - -print 'CREATE AND SAVE MAGDATA OBJECT!' -mag_data = py.VectorData(a, magnitude) -mag_data.save_to_netcdf4('magdata_vtk_{}'.format(filename.replace('.vtk', '.nc'))) - -py.pm(mag_data).display_combined() +mag_data = pr.VectorData(a, magnitude) +mag_data.save_to_hdf5('magdata_vtk_{}'.format(filename.replace('.vtk', '.hdf5')), overwrite=True) +# Plot stuff: +pr.pm(mag_data).display_combined() +plt.show() diff --git a/scripts/phasemap/phasemap_from_dm3.py b/scripts/phasemap/phasemap_from_dm3.py index 2bfaa4a4623925da8bb75e136a1dfb07744f79c9..3eaf9d6cfbdca2473836ad494b1c298457587910 100644 --- a/scripts/phasemap/phasemap_from_dm3.py +++ b/scripts/phasemap/phasemap_from_dm3.py @@ -1,14 +1,16 @@ # -*- coding: utf-8 -*- """Create magnetization distributions from DM3 (Digital Micrograph 3) files.""" - +import logging.config import os + import numpy as np -import hyperspy.hspy as hp from PIL import Image + +import hyperspy.hspy as hp import pyramid as py -import logging.config +import matplotlib.pyplot as plt logging.config.fileConfig(py.LOGGING_CONFIG, disable_existing_loggers=False) @@ -16,7 +18,7 @@ logging.config.fileConfig(py.LOGGING_CONFIG, disable_existing_loggers=False) path_mag = 'zi_an_38kx_220K_09p32_w1198_h154.dm3' path_mask = 'zi_an_38kx_220K_00p10_w1198_h154_mask_in.txt' path_conf = None -filename = 'phasemap_dm3_zi_an_magnetite_09p32.nc' +filename = 'phasemap_dm3_zi_an_magnetite_09p32.hdf5' a = 1. dim_uv = None threshold = 0.5 @@ -27,9 +29,9 @@ flip_up_down = True im_mag_hp = hp.load(os.path.join(py.DIR_FILES, 'dm3', path_mag)) im_mag = Image.fromarray(im_mag_hp.data) if path_mask is not None: -# im_mask_hp = hp.load(os.path.join(py.DIR_FILES, 'dm3', path_mask)) + # im_mask_hp = hp.load(os.path.join(pr.DIR_FILES, 'dm3', path_mask)) mask_data = np.genfromtxt(os.path.join(py.DIR_FILES, 'dm3', path_mask), delimiter=',') - im_mask = Image.fromarray(mask_data)#)im_mask_hp.data) + im_mask = Image.fromarray(mask_data) # )im_mask_hp.data) else: im_mask = Image.new('F', im_mag.size, 'white') if path_conf is not None: @@ -53,5 +55,6 @@ confidence = np.where(np.asarray(im_conf) >= threshold, 1, 0) # Create and save PhaseMap object: phase_map = py.PhaseMap(a, phase, mask, confidence, unit='rad') -phase_map.save_to_netcdf4(os.path.join(py.DIR_FILES, 'phasemap', filename)) +phase_map.save_to_hdf5(os.path.join(py.DIR_FILES, 'phasemap', filename), overwrite=True) phase_map.display_combined() +plt.show() diff --git a/scripts/phasemap/phasemap_from_image.py b/scripts/phasemap/phasemap_from_image.py index cd4e441fa14bc7eb5de84ed19d1cf99c4d3ce062..e2e28a9981196e52fc3b1d0d2e6c492abc6c23b8 100644 --- a/scripts/phasemap/phasemap_from_image.py +++ b/scripts/phasemap/phasemap_from_image.py @@ -1,20 +1,21 @@ # -*- coding: utf-8 -*- """Create magnetization distributions from image-files.""" - +import logging.config import os + import numpy as np from PIL import Image -import pyramid as py -import logging.config +import pyramid as py +import matplotlib.pyplot as plt logging.config.fileConfig(py.LOGGING_CONFIG, disable_existing_loggers=False) ################################################################################################### path_mag = 'Arnaud_M.tif' path_mask = 'Arnaud_MIP_mask.tif' -filename = 'phasemap_{}_{}.nc'.format(*list(reversed(path_mag.split('.')))) +filename = 'phasemap_{}_{}.hdf5'.format(*list(reversed(path_mag.split('.')))) a = 2 # nm dim_uv = None max_phase = 1 @@ -29,7 +30,7 @@ if flip_up_down: im_mag = im_mag.transpose(Image.FLIP_TOP_BOTTOM) if dim_uv is not None: im_mag = im_mag.resize(dim_uv) -phase = np.asarray(im_mag)/255.*max_phase - offset +phase = np.asarray(im_mag) / 255. * max_phase - offset # Create mask: mask = None @@ -39,9 +40,10 @@ if path_mask is not None: im_mask = im_mask.transpose(Image.FLIP_TOP_BOTTOM) if dim_uv is not None: im_mask = im_mask.resize(dim_uv) - mask = np.where(np.asarray(im_mask)/255. >= threshold, True, False) + mask = np.where(np.asarray(im_mask) / 255. >= threshold, True, False) # Create and save PhaseMap object: phase_map = py.PhaseMap(a, phase, mask, confidence=None, unit='rad') -phase_map.save_to_netcdf4(os.path.join(py.DIR_FILES, 'phasemap', filename)) +phase_map.save_to_hdf5(os.path.join(py.DIR_FILES, 'phasemap', filename), overwrite=True) phase_map.display_combined() +plt.show() diff --git a/scripts/phasemap/phasemap_from_raw.py b/scripts/phasemap/phasemap_from_raw.py index a146bd5f72d07d566031c752466de34f85fed675..887004147a61f22c580a753e828dad63f455a8b2 100644 --- a/scripts/phasemap/phasemap_from_raw.py +++ b/scripts/phasemap/phasemap_from_raw.py @@ -1,12 +1,14 @@ # -*- coding: utf-8 -*- """Create magnetization distributions from a raw image format.""" - +import logging.config import os + +import pyramid as pr + +import matplotlib.pyplot as plt import numpy as np from PIL import Image -import pyramid as pr -import logging.config logging.config.fileConfig(pr.LOGGING_CONFIG, disable_existing_loggers=False) @@ -14,7 +16,7 @@ logging.config.fileConfig(pr.LOGGING_CONFIG, disable_existing_loggers=False) ################################################################################################### path_mag = '83-225x148.raw' path_mask = path_mag -filename = 'skyrmion_cutout_83.nc' +filename = 'skyrmion_cutout_83.hdf5' im_size = (225, 148) dim_uv = None a = 1. @@ -39,5 +41,6 @@ mask = np.where(np.asarray(im_mask) >= threshold, True, False) # Create and save PhaseMap object: phase_map = pr.PhaseMap(a, phase, mask, confidence=None, unit='rad') -phase_map.save_to_netcdf4(os.path.join(pr.DIR_FILES, 'phasemap', filename)) +phase_map.save_to_hdf5(os.path.join(pr.DIR_FILES, 'phasemap', filename), overwrite=True) phase_map.display_combined() +plt.show() diff --git a/scripts/phasemap/phasemap_projection_arbitrary.py b/scripts/phasemap/phasemap_projection_arbitrary.py deleted file mode 100644 index baa3fbd81a51a66e60e676cdc3c4f933a2bbbdb1..0000000000000000000000000000000000000000 --- a/scripts/phasemap/phasemap_projection_arbitrary.py +++ /dev/null @@ -1,27 +0,0 @@ -# -*- coding: utf-8 -*- -"""Create PhaseMaps from MagDatas via simple axis projection.""" - - -import numpy as np -import pyramid as py -import logging.config - - -logging.config.fileConfig(py.LOGGING_CONFIG, disable_existing_loggers=False) - -################################################################################################### -filename = 'magdata_mc_paper2_homog_slab_simulated_dim=(1, 512, 512).nc' -b_0 = 1. -dim_uv = None -rotation = np.pi/4. -tilt = 0. -################################################################################################### - -mag_data = py.VectorData.load_from_netcdf4(filename) -projector = py.RotTiltProjector(mag_data.dim, rotation, tilt, dim_uv) -mag_proj = projector(mag_data) -phasemapper = py.PhaseMapperRDFC(py.Kernel(mag_data.a, projector.dim_uv, b_0)) -phase_map = phasemapper(mag_proj) -phase_map.mask = mag_proj.get_mask()[0, ...] -phase_map.save_to_netcdf4('phasemap_{}'.format(filename.replace('magdata_', ''))) -phase_map.display_combined() diff --git a/scripts/phasemap/phasemap_projection_simple.py b/scripts/phasemap/phasemap_projection_simple.py deleted file mode 100644 index 1141d660ccb00e6cd291041b7497951172ed4287..0000000000000000000000000000000000000000 --- a/scripts/phasemap/phasemap_projection_simple.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -"""Create PhaseMaps from MagDatas via simple axis projection.""" - - -import pyramid as py -import logging.config - - -logging.config.fileConfig(py.LOGGING_CONFIG, disable_existing_loggers=False) - -################################################################################################### -filename = 'magdata_mc_array_sphere_disc_slab.nc' -b_0 = 1. -dim_uv = None -################################################################################################### - -mag_data = py.VectorData.load_from_netcdf4(filename) -phase_map = py.pm(mag_data, dim_uv=dim_uv, b_0=b_0) -phase_map.save_to_netcdf4('phasemap_{}'.format(filename.replace('magdata_', ''))) -phase_map.display_combined() diff --git a/scripts/phasemap/phasemap_tilt_series.py b/scripts/phasemap/phasemap_tilt_series.py deleted file mode 100644 index 992bcef7352183673387c1bbff932cb5de04576d..0000000000000000000000000000000000000000 --- a/scripts/phasemap/phasemap_tilt_series.py +++ /dev/null @@ -1,59 +0,0 @@ -# -*- coding: utf-8 -*- -"""Create PhaseMaps from MagDatas via simple axis projection.""" - - -import numpy as np -import pyramid as py -import logging.config - - -logging.config.fileConfig(py.LOGGING_CONFIG, disable_existing_loggers=False) - -################################################################################################### -filename = 'magdata_mc_homog_sphere_dim=(32, 32, 32).nc' -b_0 = 1. -axis = 'z' -dim_uv = None - -angles = np.linspace() -################################################################################################### - -mag_data = py.VectorData.load_from_netcdf4(filename) -phase_map = py.pm(mag_data, mode=axis, dim_uv=dim_uv, b_0=b_0) -phase_map.save_to_netcdf4('phasemap_{}_axis={}'.format(filename.replace('magdata_', ''), axis)) -phase_map.display_combined() - - -dim = mag_data.dim -dim_uv = (500, 200) -angles = np.arange(-60, 61, 5)#[0, 20, 40, 60] - -#mag_data_xy = mag_data.copy() -# mag_data_xy.field[2] = 0 -# -#mag_data_z = mag_data.copy() -# mag_data_z.field[0] = 0 -# mag_data_z.field[1] = 0 - -# Iterate over all angles: -for angle in angles: - angle_rad = np.pi/2 + angle*np.pi/180 - projector = XTiltProjector(dim, angle_rad, dim_uv) - mag_proj = projector(mag_data) - phase_map = PhaseMapperRDFC(Kernel(mag_data.a, projector.dim_uv))(mag_proj) - phase_map.display_phase('Phase Map Nanowire Tip', cmap='gray') - plt.savefig(PATH+'_nanowire_xtilt_{}.png'.format(angle), dpi=500) -# phase_map = PhaseMapperRDFC(Kernel(mag_data.a, projector.dim_uv))(mag_proj) -# phase_map.display_combined('Phase Map Nanowire Tip', gain=gain, -# interpolation='bilinear') -# plt.savefig(PATH+'_nanowire_xtilt_{}.png'.format(angle), dpi=500) -# mag_proj.scale_down(2) -# axis = mag_proj.quiver_plot() -# plt.savefig(PATH+'_nanowire_mag_xtilt_{}.png'.format(angle), dpi=500) -# axis = mag_proj.quiver_plot(log=True) -# plt.savefig(PATH+'_nanowire_mag_log_xtilt_{}.png'.format(angle), dpi=500) - # Close plots: - plt.close('all') - gc.collect() - print 'RSS = {:.2f} MB'.format(proc.memory_info().rss/1024.**2) - print angle, 'deg. done!' diff --git a/scripts/reconstruction/reconstruction_2d_from_phasemap.py b/scripts/reconstruction/reconstruction_2d_from_phasemap.py index 1777cf3b47958005b317525b8e0ecdaa86ba15bf..7ed9b370d64d21009c8ed104d1fdc50e11bd9d2e 100644 --- a/scripts/reconstruction/reconstruction_2d_from_phasemap.py +++ b/scripts/reconstruction/reconstruction_2d_from_phasemap.py @@ -1,17 +1,17 @@ # -*- coding: utf-8 -*- """Reconstruct a magnetization distributions from a single phase map.""" +from __future__ import print_function import numpy as np import pyramid as pr from jutil.taketime import TakeTime import logging.config - logging.config.fileConfig(pr.LOGGING_CONFIG, disable_existing_loggers=False) ################################################################################################### -phase_name = 'phasemap_gui_Pha1' +phase_name = 'phasemap_gui_150917_skyrm_M_100mT' b_0 = 1 # in T lam = 1E-1 max_iter = 100 @@ -21,7 +21,7 @@ order = 1 # Load phase map: -phase_map = pr.PhaseMap.load_from_netcdf4(phase_name+'.nc') +phase_map = pr.PhaseMap.load_from_hdf5(phase_name + '.hdf5') phase_map.pad((buffer_pixel, buffer_pixel)) dim = (1,) + phase_map.dim_uv @@ -41,14 +41,17 @@ with TakeTime('reconstruction time'): if order >= 1: offset, ramp = param_cache[0][0], (param_cache[1][0], param_cache[2][0]) elif order == 0: - offset = param_cache[0][0] + offset, ramp = param_cache[0][0], (0, 0) +else: + offset, ramp = 0, (0, 0) mag_data_buffer = mag_data_rec.copy() mag_data_rec.crop((0, buffer_pixel, buffer_pixel)) mag_name = '{}_lam={}'.format(phase_name.replace('phasemap', 'magdata_rec'), lam) -mag_data_rec.save_to_netcdf4(mag_name+'.nc') +mag_data_rec = mag_data_rec.flip(axis='y') +mag_data_rec.save_to_hdf5(mag_name + '.hdf5', overwrite=True) # Plot stuff: -mag_data_rec.quiver_plot('Reconstructed Distribution', ar_dens=int(np.ceil(np.max(dim)/128.))) +mag_data_rec.quiver_plot('Reconstructed Distribution', ar_dens=int(np.ceil(np.max(dim) / 128.))) phase_map.crop((buffer_pixel, buffer_pixel)) phase_map.display_combined('Input Phase') phase_map -= fwd_model.ramp(index=0) @@ -56,13 +59,13 @@ phase_map.display_combined('Input Phase (ramp corrected)') phase_map_rec = pr.pm(mag_data_rec) title = 'Reconstructed Phase' if order >= 0: - print 'offset:', offset + print('offset:', offset) title += ', fitted Offset: {:.2g} [rad]'.format(offset) if order >= 1: - print 'ramp:', ramp + print('ramp:', ramp) title += ', (Fitted Ramp: (u:{:.2g}, v:{:.2g}) [rad/nm]'.format(*ramp) phase_map_rec.display_combined(title) -difference = (phase_map_rec.phase-phase_map.phase).mean() -(phase_map_rec-phase_map).display_phase('Difference (mean: {:.2g})'.format(difference)) +difference = (phase_map_rec.phase - phase_map.phase).mean() +(phase_map_rec - phase_map).display_phase('Difference (mean: {:.2g})'.format(difference)) if order is not None: fwd_model.ramp(0).display_combined('Fitted Ramp') diff --git a/scripts/reconstruction/reconstruction_3d_from_magdata.py b/scripts/reconstruction/reconstruction_3d_from_magdata.py index 25981c68572a45ef15e2e90f09cb24a356c6690b..fe670147c3882eeb66fa72802482dd46c0ab9a33 100644 --- a/scripts/reconstruction/reconstruction_3d_from_magdata.py +++ b/scripts/reconstruction/reconstruction_3d_from_magdata.py @@ -12,7 +12,7 @@ from jutil.taketime import TakeTime logging.config.fileConfig(pr.LOGGING_CONFIG, disable_existing_loggers=False) ################################################################################################### -mag_name = 'magdata_mc_vortex_disc' +mag_name = 'magdata_mc_horseshoe' dim_uv = None angles = np.linspace(-90, 90, num=7) axes = {'x': True, 'y': True} @@ -25,73 +25,67 @@ offset_max = 2 ramp_max = 0.01 order = 1 show_input = True -# TODO: toggle multiprocessing if nprocs > 1 +nprocs = mp.cpu_count() # or 1 for non-multiprocessing ################################################################################################### if __name__ == '__main__': - mp.freeze_support() - # Load magnetization distribution: mag_data = pr.VectorData.load_from_hdf5(mag_name + '.hdf5') dim = mag_data.dim - # Construct data set and regularisator: data = pr.DataSet(mag_data.a, mag_data.dim, b_0) - # Construct projectors: projectors = [] for angle in angles: - angle_rad = angle*np.pi/180 + angle_rad = angle * np.pi / 180 if axes['x']: projectors.append(pr.XTiltProjector(mag_data.dim, angle_rad, dim_uv)) if axes['y']: projectors.append(pr.YTiltProjector(mag_data.dim, angle_rad, dim_uv)) - # Add projectors and construct according phase maps: data.projectors = projectors data.phase_maps = data.create_phase_maps(mag_data) - for i, phase_map in enumerate(data.phase_maps): offset = np.random.uniform(-offset_max, offset_max) ramp_u = np.random.uniform(-ramp_max, ramp_max) ramp_v = np.random.uniform(-ramp_max, ramp_max) phase_map += pr.Ramp.create_ramp(phase_map.a, phase_map.dim_uv, (offset, ramp_u, ramp_v)) - # Add noise if necessary: if noise != 0: for i, phase_map in enumerate(data.phase_maps): phase_map.phase += np.random.normal(0, noise, phase_map.dim_uv) data.phase_maps[i] = phase_map - # Plot input: if show_input: for i, phase_map in enumerate(data.phase_maps): phase_map.display_phase() - # Construct mask: -# if use_internal_mask: -# data.mask = mag_data.get_mask() # Use perfect mask from mag_data! -# else: -# data.set_3d_mask() # Construct mask from 2D phase masks! - + if use_internal_mask: + data.mask = mag_data.get_mask() # Use perfect mask from mag_data! + else: + data.set_3d_mask() # Construct mask from 2D phase masks! # Construct regularisator, forward model and costfunction: - fwd_model = pr.DistributedForwardModel(data, ramp_order=order, nprocs=4) + if nprocs > 1: + fwd_model = pr.DistributedForwardModel(data, ramp_order=order, nprocs=nprocs) + else: + fwd_model = pr.ForwardModel(data, ramp_order=order) reg = pr.FirstOrderRegularisator(data.mask, lam, add_params=fwd_model.ramp.n) cost = pr.Costfunction(fwd_model, reg) - # Reconstruct and save: with TakeTime('reconstruction time'): mag_data_rec = pr.reconstruction.optimize_linear(cost, max_iter=max_iter) param_cache = cost.fwd_model.ramp.param_cache fwd_model.finalize() mag_name_rec = mag_name.replace('magdata', 'magdata_rec') - mag_data_rec.save_to_netcdf4(mag_name_rec+'.nc') - + mag_data_rec.save_to_hdf5(mag_name_rec + '.hdf5', overwrite=True) # Plot stuff: - data.display_mask(ar_dens=np.ceil(np.max(dim)/64.)) - mag_data.quiver_plot3d('Original Distribution', ar_dens=np.ceil(np.max(dim)/64.)) - mag_data_rec.quiver_plot3d('Reconstructed Distribution', ar_dens=np.ceil(np.max(dim)/64.)) - mag_data_rec.quiver_plot3d('Reconstructed Distribution', ar_dens=np.ceil(np.max(dim)/64.), + data.display_mask(ar_dens=np.ceil(np.max(dim) / 64.)) + mag_data.quiver_plot3d('Original Distribution', ar_dens=np.ceil(np.max(dim) / 64.)) + mag_data_rec.quiver_plot3d('Reconstructed Distribution', ar_dens=np.ceil(np.max(dim) / 64.)) + mag_data_rec.quiver_plot3d('Reconstructed Distribution', ar_dens=np.ceil(np.max(dim) / 64.), coloring='amplitude') + import matplotlib.pyplot as plt + + plt.show()