Skip to content

hyperspy/hyperspy_swift_library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Hyperspy Swift Library

Read Nion Swift libraries into HyperSpy object.

Installation

This package depends on Nion Swift. Installing it with conda before installing hyperspy_swift_library is recommended.

pip install --upgrade https://github.com/hyperspy/hyperspy_swift_library/archive/master.tar.gz

Usage

>>> from hyperspy_swift_library import SwiftLibraryReader
>>> project = SwiftLibraryReader("Nion Swift Project 20221025.nsproj")

If pandas is installed, the get_data_items_properties returns a Pandas DataFrame.

Using Pandas syntax, it is very easy to select the information that you want to display. For example, to display only the title and data_shape columns of the DataFrame:

>>> df = project.get_data_items_properties()
>>> df[["title", "data_shape"]]
                                title        data_shape
0                                EELS       [128, 1024]
1                     Orsay Scan (BF)        [512, 512]
2                                EELS            [1024]
3              Orsay Scan (eels_spim)  [256, 256, 1024]
4  Pick Sum of Orsay Scan (eels_spim)        <Not data>

To filter data based on its title:

>>> df[df['title'].str.endswith("(BF)")]['title']
1    Orsay Scan (BF)
Name: title, dtype: object

To load data as a HyperSpy signal:

>>> s = project.load_data(0)
>>> s
<LazySignal2D, title: , dimensions: (|1024, 128)>

About

HyperSpy Nion Swift Library reader

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages