sasdata


Namesasdata JSON
Version 0.9.0 PyPI version JSON
download
home_pagehttps://sasview.org
SummarySas Data Loader application
upload_time2024-09-10 15:10:05
maintainerNone
docs_urlNone
authorSasView Team
requires_pythonNone
licenseCopyright (c) 2009-2024, SasView Developers All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
keywords small-angle x-ray and neutron scattering data loading
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Sasdata

A package for importing and exporting reduced small angle scattering data.

The data loaders provided are usable as a standalone package, or in conjunction with the sasview analysis package.

## Install
The easiest way to use sasdata is by using [SasView](http://www.sasview.org).

View the latest release on the [sasdata pypi page](https://pypi.org/project/sasdata/) and install using `pip install sasdata`.

To run sasdata from the source, create a python environment using python 3.8 or higher and install all dependencies
 - Using a [python virtual environment](https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/)::

       $ python -m venv sasdata
       $ .\sasdata\Scripts\activate (Windows) -or- source sasdata/bin/activate (Mac/Linux)
       (sasdata) $ python -m pip install -r requirements.txt
       (sasdata) $ python /path/to/sasdata/setup.py clean build
       (sasdata) $ python -m pip install .
 
 - Using [miniconda](https://docs.conda.io/en/latest/miniconda.html)
or [anaconda](https://www.anaconda.com/)::
   
       $ conda create -n sasdata
       $ conda activate sasdata
       (sasdata) $ python -m pip install -r requirements.txt
       (sasdata) $ python /path/to/sasdata/setup.py clean build
       (sasdata) $ python -m pip install .

## Data Formats

The `Loader()` class is directly callable so a transient call can be made to the class or, for cases where repeated calls
are necessary, the `Loader()` instance can be assigned to a python variable.

The `Loader.load()` method accepts a string or list of strings to load a single or multiple data sets simultaneously. The
strings passed to `load()` can be any combination of file path representations, or URIs. A list of `Data1D/Data2D`
objects is returned. An optional `format` parameter can be passed to specify the expected file extension associated with 
a reader. If format is passed, it must either be a single value, or a list of values of the same length as the file path list.

- Load `format` options include:
  - `.xml`: [canSAS XML](https://www.cansas.org/formats/canSAS1d/1.1/doc/index.html) format
  - `.h5`, `.hdf`, `.hdf5`, `.nxs`: [NXcanSAS](https://manual.nexusformat.org/classes/applications/NXcanSAS.html) format
  - `.txt`: Multi-column ascii format
  - `.csv`: Comma delimited text format
  - `.ses`, `.sesans`: [Multi-column SESANS](https://www.sasview.org/docs/user/qtgui/MainWindow/data_formats_help.html#d-sesans-format) data
  - `.dat`: [2D NIST](https://github.com/sansigormacros/ncnrsansigormacros/wiki/NCNROutput2D_QxQy) format
  - `.abs`, `.cor`: 1D NIST format for SAS and USAS
  - `.pdh`: Anton Paar reduced SAXS format

The `save()` method accepts 3 arguments; the file path to save the file as, a `Data1D` or `Data2D` object, and, optionally, 
a file extension. If an extension is passed to `save`, any file extension in the file path will be superseded. If no file
extension is given in the filename or format, a ValueError will be thrown.

- Save `format` options include:
  - `.xml`: for the canSAS XML format
  - `.h5`: for the NXcanSAS format
  - `.txt`: for the multi-column ascii format
  - `.csv`: for a comma delimited text format

Save argument examples and data output:

| filename     | format | saved file name | saved file format |
|--------------|--------|-----------------|-------------------|
| 'mydata'     | '.csv' | mydata.csv      | CSV format        |
| 'mydata.xml' | None   | mydata.xml      | canSAS XML format |
| 'mydata.xml' | '.csv' | mydata.xml.csv  | CSV format        |
| 'mydata'     | None   | -               | raise ValueError  |

More information on the recognized data formats is available on the 
[sasview website](https://www.sasview.org/docs/user/qtgui/MainWindow/data_formats_help.html).

## Example Data

A number of data files are included with this package available in `sasdata.example_data`.

- Each subdirectory has a specific type of data.
  - `1d_data`: 1-dimensional SAS data. A few examples are `apoferritin.txt` which is SANS from apoferritin, 3 files starting with `AOT_` that are contrast variations for a mircroemulsion, and `latex_smeared.xml` with SANS and USANS data for spherical latex particles.
  - `2d_data`: 2-dimensional SAS data. Examples include 3 `P123_....dat` files for a polymer concentration series.
  - `convertibles_files`: A series of data sets that can be converted via the data conversion tool in the `sasdata.file_converter` package.
  - `dls_data`: *NOTE* Not loadable by sasdata. Two example DLS data sets that will be loadable in a future release.
  - `image_data`: Image file loadable from `sasdata.dataloader.readers.tiff_reader`. The files are all the same image, but in different image formats.
  - `sesans_data`: SESANS data sets. `sphere_isis.ses` is spin-echo SANS from a sample with spherical particles.
- To directly access this data via a python prompt, `import data_path from sasdata` returns the absolute path to `sasdata.example_data`

## Usage

### Accessing example data

    (sasdata) $ python
    >>> from sasdata import data_path
    >>> data = Loader().load(os.path.join(data_path, '1d_data', 'apoferritin.txt'))

### Loading and saving data sets using a fixed Loader instance:

    (sasdata) $ python
    >>> from sasdata.dataloader.loader import Loader
    >>> loader_module = Loader()
    >>> loaded_data_sets = loader_module.load(path="/path/to/file.ext")
    >>> loaded_data_set = loaded_data_sets[0]
    >>> loader_module.save(path='/path/to/new/file.ext', data=loaded_data_set, format=None)

### Loading and saving data sets using a transient Loader instance (more scriptable):

    (sasdata) $ python
    >>> from sasdata.dataloader.loader import Loader
    >>> loaded_data_sets = Loader().load(path="/path/to/file.ext")
    >>> Loader().save(path='/path/to/new/file.ext', data=loaded_data_sets[0], format=None)

            

Raw data

            {
    "_id": null,
    "home_page": "https://sasview.org",
    "name": "sasdata",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "small-angle x-ray and neutron scattering data loading",
    "author": "SasView Team",
    "author_email": "developers@sasview.org",
    "download_url": "https://files.pythonhosted.org/packages/01/40/013b07f430ce3eab5b110a102e0861500a19f3485dee7ecb53099b29d481/sasdata-0.9.0.tar.gz",
    "platform": null,
    "description": "# Sasdata\r\n\r\nA package for importing and exporting reduced small angle scattering data.\r\n\r\nThe data loaders provided are usable as a standalone package, or in conjunction with the sasview analysis package.\r\n\r\n## Install\r\nThe easiest way to use sasdata is by using [SasView](http://www.sasview.org).\r\n\r\nView the latest release on the [sasdata pypi page](https://pypi.org/project/sasdata/) and install using `pip install sasdata`.\r\n\r\nTo run sasdata from the source, create a python environment using python 3.8 or higher and install all dependencies\r\n - Using a [python virtual environment](https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/)::\r\n\r\n       $ python -m venv sasdata\r\n       $ .\\sasdata\\Scripts\\activate (Windows) -or- source sasdata/bin/activate (Mac/Linux)\r\n       (sasdata) $ python -m pip install -r requirements.txt\r\n       (sasdata) $ python /path/to/sasdata/setup.py clean build\r\n       (sasdata) $ python -m pip install .\r\n \r\n - Using [miniconda](https://docs.conda.io/en/latest/miniconda.html)\r\nor [anaconda](https://www.anaconda.com/)::\r\n   \r\n       $ conda create -n sasdata\r\n       $ conda activate sasdata\r\n       (sasdata) $ python -m pip install -r requirements.txt\r\n       (sasdata) $ python /path/to/sasdata/setup.py clean build\r\n       (sasdata) $ python -m pip install .\r\n\r\n## Data Formats\r\n\r\nThe `Loader()` class is directly callable so a transient call can be made to the class or, for cases where repeated calls\r\nare necessary, the `Loader()` instance can be assigned to a python variable.\r\n\r\nThe `Loader.load()` method accepts a string or list of strings to load a single or multiple data sets simultaneously. The\r\nstrings passed to `load()` can be any combination of file path representations, or URIs. A list of `Data1D/Data2D`\r\nobjects is returned. An optional `format` parameter can be passed to specify the expected file extension associated with \r\na reader. If format is passed, it must either be a single value, or a list of values of the same length as the file path list.\r\n\r\n- Load `format` options include:\r\n  - `.xml`: [canSAS XML](https://www.cansas.org/formats/canSAS1d/1.1/doc/index.html) format\r\n  - `.h5`, `.hdf`, `.hdf5`, `.nxs`: [NXcanSAS](https://manual.nexusformat.org/classes/applications/NXcanSAS.html) format\r\n  - `.txt`: Multi-column ascii format\r\n  - `.csv`: Comma delimited text format\r\n  - `.ses`, `.sesans`: [Multi-column SESANS](https://www.sasview.org/docs/user/qtgui/MainWindow/data_formats_help.html#d-sesans-format) data\r\n  - `.dat`: [2D NIST](https://github.com/sansigormacros/ncnrsansigormacros/wiki/NCNROutput2D_QxQy) format\r\n  - `.abs`, `.cor`: 1D NIST format for SAS and USAS\r\n  - `.pdh`: Anton Paar reduced SAXS format\r\n\r\nThe `save()` method accepts 3 arguments; the file path to save the file as, a `Data1D` or `Data2D` object, and, optionally, \r\na file extension. If an extension is passed to `save`, any file extension in the file path will be superseded. If no file\r\nextension is given in the filename or format, a ValueError will be thrown.\r\n\r\n- Save `format` options include:\r\n  - `.xml`: for the canSAS XML format\r\n  - `.h5`: for the NXcanSAS format\r\n  - `.txt`: for the multi-column ascii format\r\n  - `.csv`: for a comma delimited text format\r\n\r\nSave argument examples and data output:\r\n\r\n| filename     | format | saved file name | saved file format |\r\n|--------------|--------|-----------------|-------------------|\r\n| 'mydata'     | '.csv' | mydata.csv      | CSV format        |\r\n| 'mydata.xml' | None   | mydata.xml      | canSAS XML format |\r\n| 'mydata.xml' | '.csv' | mydata.xml.csv  | CSV format        |\r\n| 'mydata'     | None   | -               | raise ValueError  |\r\n\r\nMore information on the recognized data formats is available on the \r\n[sasview website](https://www.sasview.org/docs/user/qtgui/MainWindow/data_formats_help.html).\r\n\r\n## Example Data\r\n\r\nA number of data files are included with this package available in `sasdata.example_data`.\r\n\r\n- Each subdirectory has a specific type of data.\r\n  - `1d_data`: 1-dimensional SAS data. A few examples are `apoferritin.txt` which is SANS from apoferritin, 3 files starting with `AOT_` that are contrast variations for a mircroemulsion, and `latex_smeared.xml` with SANS and USANS data for spherical latex particles.\r\n  - `2d_data`: 2-dimensional SAS data. Examples include 3 `P123_....dat` files for a polymer concentration series.\r\n  - `convertibles_files`: A series of data sets that can be converted via the data conversion tool in the `sasdata.file_converter` package.\r\n  - `dls_data`: *NOTE* Not loadable by sasdata. Two example DLS data sets that will be loadable in a future release.\r\n  - `image_data`: Image file loadable from `sasdata.dataloader.readers.tiff_reader`. The files are all the same image, but in different image formats.\r\n  - `sesans_data`: SESANS data sets. `sphere_isis.ses` is spin-echo SANS from a sample with spherical particles.\r\n- To directly access this data via a python prompt, `import data_path from sasdata` returns the absolute path to `sasdata.example_data`\r\n\r\n## Usage\r\n\r\n### Accessing example data\r\n\r\n    (sasdata) $ python\r\n    >>> from sasdata import data_path\r\n    >>> data = Loader().load(os.path.join(data_path, '1d_data', 'apoferritin.txt'))\r\n\r\n### Loading and saving data sets using a fixed Loader instance:\r\n\r\n    (sasdata) $ python\r\n    >>> from sasdata.dataloader.loader import Loader\r\n    >>> loader_module = Loader()\r\n    >>> loaded_data_sets = loader_module.load(path=\"/path/to/file.ext\")\r\n    >>> loaded_data_set = loaded_data_sets[0]\r\n    >>> loader_module.save(path='/path/to/new/file.ext', data=loaded_data_set, format=None)\r\n\r\n### Loading and saving data sets using a transient Loader instance (more scriptable):\r\n\r\n    (sasdata) $ python\r\n    >>> from sasdata.dataloader.loader import Loader\r\n    >>> loaded_data_sets = Loader().load(path=\"/path/to/file.ext\")\r\n    >>> Loader().save(path='/path/to/new/file.ext', data=loaded_data_sets[0], format=None)\r\n",
    "bugtrack_url": null,
    "license": "Copyright (c) 2009-2024, SasView Developers All rights reserved.  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ",
    "summary": "Sas Data Loader application",
    "version": "0.9.0",
    "project_urls": {
        "Download": "https://github.com/SasView/sasdata.git",
        "Homepage": "https://sasview.org"
    },
    "split_keywords": [
        "small-angle",
        "x-ray",
        "and",
        "neutron",
        "scattering",
        "data",
        "loading"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7bb6b50276ae6311a280398eed89758d6a9c83c8e1599b55d35664c1666585b9",
                "md5": "80c5cca0326bcf33b0b08892546d5632",
                "sha256": "b13892fca2fef5283a6a03fbcb1e791cad8ed485ab979fd9119d2922ce0876c2"
            },
            "downloads": -1,
            "filename": "sasdata-0.9.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "80c5cca0326bcf33b0b08892546d5632",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 19826163,
            "upload_time": "2024-09-10T15:10:00",
            "upload_time_iso_8601": "2024-09-10T15:10:00.611548Z",
            "url": "https://files.pythonhosted.org/packages/7b/b6/b50276ae6311a280398eed89758d6a9c83c8e1599b55d35664c1666585b9/sasdata-0.9.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0140013b07f430ce3eab5b110a102e0861500a19f3485dee7ecb53099b29d481",
                "md5": "50281689b6438e24d6955d1564777242",
                "sha256": "0a03953d3d82e0d4f0fe570b4d653df382f4ca431a723e3b3c898a8275f399ca"
            },
            "downloads": -1,
            "filename": "sasdata-0.9.0.tar.gz",
            "has_sig": false,
            "md5_digest": "50281689b6438e24d6955d1564777242",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 24966978,
            "upload_time": "2024-09-10T15:10:05",
            "upload_time_iso_8601": "2024-09-10T15:10:05.580130Z",
            "url": "https://files.pythonhosted.org/packages/01/40/013b07f430ce3eab5b110a102e0861500a19f3485dee7ecb53099b29d481/sasdata-0.9.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-10 15:10:05",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "SasView",
    "github_project": "sasdata",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "sasdata"
}
        
Elapsed time: 0.70533s