Skip to content

Commit

Permalink
Merge pull request #2141 from SasView/use-sasdata
Browse files Browse the repository at this point in the history
Use sasdata package in place of sas.sascalc.dataloader
  • Loading branch information
Wojciech Potrzebowski authored Aug 30, 2022
2 parents 8514803 + 289f9bb commit 3d56736
Show file tree
Hide file tree
Showing 164 changed files with 105 additions and 199,814 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,19 @@ jobs:
- name: Fetch sources for sibling projects
run: |
git clone --depth=50 --branch=master https://github.com/SasView/sasdata.git ../sasdata
git clone --depth=50 --branch=master https://github.com/SasView/sasmodels.git ../sasmodels
git clone --depth=50 --branch=master https://github.com/bumps/bumps.git ../bumps
- name: Build and install sasdata
run: |
cd ../sasdata
rm -rf build
rm -rf dist
python setup.py clean
python setup.py build
python -m pip install .
- name: Build and install sasmodels
run: |
cd ../sasmodels
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/installers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,19 @@ jobs:
- name: Fetch sources for sibling projects
run: |
git clone --depth=50 --branch=master https://github.com/SasView/sasdata.git ../sasdata
git clone --depth=50 --branch=master https://github.com/SasView/sasmodels.git ../sasmodels
git clone --depth=50 --branch=master https://github.com/bumps/bumps.git ../bumps
- name: Build and install sasdata
run: |
cd ../sasdata
rm -rf build
rm -rf dist
python setup.py clean
python setup.py build
python -m pip install .
- name: Build and install sasmodels
run: |
cd ../sasmodels
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,22 @@ jobs:
run: |
python -m pip install pyinstaller
### TODO: Bumps and sasmodels branches needs to be setup manually until we find better mechanism
### TODO: Bumps, sasdata and sasmodels branches needs to be setup manually until we find better mechanism
- name: Fetch sources for sibling projects
run: |
git clone --depth=50 --branch=master https://github.com/SasView/sasdata.git ../sasdata
git clone --depth=1 --branch=v1.0.6 https://github.com/SasView/sasmodels.git ../sasmodels
git clone --depth=1 --branch=v0.9.0 https://github.com/bumps/bumps.git ../bumps
- name: Build and install sasdata
run: |
cd ../sasdata
rm -rf build
rm -rf dist
python setup.py clean
python setup.py build
python -m pip install .
- name: Build and install sasmodels
run: |
cd ../sasmodels
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,19 @@ jobs:
- name: Fetch sources for sibling projects
run: |
git clone --depth=50 --branch=master https://github.com/SasView/sasdata.git ../sasdata
git clone --depth=50 --branch=master https://github.com/SasView/sasmodels.git ../sasmodels
git clone --depth=50 --branch=master https://github.com/bumps/bumps.git ../bumps
- name: Build and install sasdata
run: |
cd ../sasdata
rm -rf build
rm -rf dist
python setup.py clean
python setup.py build
python -m pip install .
- name: Build and install sasmodels
run: |
cd ../sasmodels
Expand Down
14 changes: 0 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,6 @@ def run(self):
packages.extend(["sas.sascalc.invariant"])


# sas.sascalc.dataloader
package_dir["sas.sascalc.dataloader"] = os.path.join(
"src", "sas", "sascalc", "dataloader")
package_data["sas.sascalc.dataloader.readers"] = ['schema/*.xsd']
packages.extend(["sas.sascalc.dataloader", "sas.sascalc.dataloader.readers",
"sas.sascalc.dataloader.readers.schema"])


# sas.sascalc.calculator
package_dir["sas.sascalc.calculator"] = os.path.join(
"src", "sas", "sascalc", "calculator")
Expand All @@ -156,12 +148,6 @@ def run(self):
package_dir["sas.sascalc.pr"] = os.path.join("src", "sas", "sascalc", "pr")
packages.append("sas.sascalc.pr")


# sas.sascalc.file_converter
package_dir["sas.sascalc.file_converter"] = os.path.join(
"src", "sas", "sascalc", "file_converter")
packages.append("sas.sascalc.file_converter")

# sas.sascalc.corfunc
package_dir["sas.sascalc.corfunc"] = os.path.join(
"src", "sas", "sascalc", "corfunc")
Expand Down
3 changes: 1 addition & 2 deletions src/sas/qtgui/Calculators/GenericScatteringCalculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@

import sas.qtgui.Utilities.GuiUtils as GuiUtils
from sas.qtgui.Utilities.GenericReader import GenReader
from sas.sascalc.dataloader.data_info import Detector
from sas.sascalc.dataloader.data_info import Source
from sasdata.dataloader.data_info import Detector, Source
from sas.sascalc.calculator import sas_gen
from sas.qtgui.Plotting.PlotterBase import PlotterBase
from sas.qtgui.Plotting.Plotter2D import Plotter2D
Expand Down
2 changes: 1 addition & 1 deletion src/sas/qtgui/Calculators/SlitSizeCalculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import sas.qtgui.Utilities.GuiUtils as GuiUtils

from .UI.SlitSizeCalculator import Ui_SlitSizeCalculator
from sas.sascalc.dataloader.loader import Loader
from sasdata.dataloader.loader import Loader
from sas.sascalc.calculator.slit_length_calculator import SlitlengthCalculator


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import sas.qtgui.path_prepare

from sas.qtgui.Calculators.SlitSizeCalculator import SlitSizeCalculator
from sas.sascalc.dataloader.loader import Loader
from sasdata.dataloader.loader import Loader

if not QtWidgets.QApplication.instance():
app = QtWidgets.QApplication(sys.argv)
Expand Down
2 changes: 1 addition & 1 deletion src/sas/qtgui/MainWindow/DataExplorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from twisted.internet import threads

# SASCALC
from sas.sascalc.dataloader.loader import Loader
from sasdata.dataloader.loader import Loader

# QTGUI
import sas.qtgui.Utilities.GuiUtils as GuiUtils
Expand Down
4 changes: 2 additions & 2 deletions src/sas/qtgui/MainWindow/DataManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@

from sas.qtgui.Utilities import GuiUtils
from sas.qtgui.MainWindow.DataState import DataState
import sas.sascalc.dataloader.data_info as DataInfo
import sasdata.dataloader.data_info as DataInfo

# used for import/export
from sas.sascalc.dataloader.data_info import Sample, Source, Vector
from sasdata.dataloader.data_info import Sample, Source, Vector

from sas.sasview import __version__ as SASVIEW_VERSION

Expand Down
2 changes: 1 addition & 1 deletion src/sas/qtgui/MainWindow/UnitTesting/DataExplorerTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# Local
from sas.qtgui.Plotting.PlotterData import Data1D, Data2D
from sas.sascalc.dataloader.loader import Loader
from sasdata.dataloader.loader import Loader
from sas.qtgui.MainWindow.DataManager import DataManager

from sas.qtgui.MainWindow.DataExplorer import DataExplorerWindow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from sas.qtgui.Perspectives.Corfunc.CorfuncPerspective import CorfuncWindow
from sas.qtgui.Plotting.PlotterData import Data1D
from sas.sascalc.dataloader.loader import Loader
from sasdata.dataloader.loader import Loader
from sas.qtgui.MainWindow.DataManager import DataManager
import sas.qtgui.Utilities.GuiUtils as GuiUtils

Expand Down
4 changes: 2 additions & 2 deletions src/sas/qtgui/Perspectives/Fitting/FittingLogic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from sas.qtgui.Plotting.PlotterData import Data1D
from sas.qtgui.Plotting.PlotterData import Data2D

from sas.sascalc.dataloader.data_info import Detector
from sas.sascalc.dataloader.data_info import Source
from sasdata.dataloader.data_info import Detector
from sasdata.dataloader.data_info import Source


class FittingLogic:
Expand Down
2 changes: 1 addition & 1 deletion src/sas/qtgui/Plotting/Masks/BoxMask.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def _post_data(self):
Get the limits of the boxsum and compute the sum of the pixel
contained in that region and the error on that sum
"""
from sas.sascalc.dataloader.manipulations import Boxcut
from sasdata.data_util.manipulations import Boxcut
# # Data 2D for which the pixel will be summed
data = self.data
mask = data.mask
Expand Down
2 changes: 1 addition & 1 deletion src/sas/qtgui/Plotting/Masks/CircularMask.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def _post_data(self):
if data is None:
return
mask = data.mask
from sas.sascalc.dataloader.manipulations import Ringcut
from sasdata.data_util.manipulations import Ringcut

rmin = 0
rmax = numpy.fabs(self.outer_circle.get_radius())
Expand Down
2 changes: 1 addition & 1 deletion src/sas/qtgui/Plotting/Masks/SectorMask.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def _post_data(self):
if self.data is None:
return
## Averaging
from sas.sascalc.dataloader.manipulations import Sectorcut
from sasdata.data_util.manipulations import Sectorcut
phimin = -self.left_line.phi + self.main_line.theta
phimax = self.left_line.phi + self.main_line.theta

Expand Down
2 changes: 1 addition & 1 deletion src/sas/qtgui/Plotting/Plotter2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from mpl_toolkits.mplot3d import Axes3D

from sas.sascalc.dataloader.manipulations import CircularAverage
from sasdata.data_util.manipulations import CircularAverage

from sas.qtgui.Plotting.PlotterData import Data1D
from sas.qtgui.Plotting.PlotterData import Data2D
Expand Down
6 changes: 3 additions & 3 deletions src/sas/qtgui/Plotting/PlotterData.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
import copy
import numpy
import math
from sas.sascalc.data_util.uncertainty import Uncertainty
from sasdata.data_util.uncertainty import Uncertainty

from sas.qtgui.Plotting.Plottables import PlottableData1D
from sas.qtgui.Plotting.Plottables import PlottableData2D

from sas.sascalc.dataloader.data_info import Data1D as LoadData1D
from sas.sascalc.dataloader.data_info import Data2D as LoadData2D
from sasdata.dataloader.data_info import Data1D as LoadData1D
from sasdata.dataloader.data_info import Data2D as LoadData2D


class Data1D(PlottableData1D, LoadData1D):
Expand Down
4 changes: 2 additions & 2 deletions src/sas/qtgui/Plotting/SlicerParameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
from sas.qtgui.Plotting.Slicers.AnnulusSlicer import AnnulusInteractor
from sas.qtgui.Plotting.Slicers.SectorSlicer import SectorInteractor

from sas.sascalc.dataloader.loader import Loader
from sas.sascalc.file_converter.nxcansas_writer import NXcanSASWriter
from sasdata.dataloader.loader import Loader
from sasdata.file_converter.nxcansas_writer import NXcanSASWriter
# Local UI
from sas.qtgui.Plotting.UI.SlicerParametersUI import Ui_SlicerParametersUI

Expand Down
2 changes: 1 addition & 1 deletion src/sas/qtgui/Plotting/Slicers/AnnulusSlicer.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def _post_data(self, nbins=None):
if data is None:
return

from sas.sascalc.dataloader.manipulations import Ring
from sasdata.data_util.manipulations import Ring
rmin = min(numpy.fabs(self.inner_circle.get_radius()),
numpy.fabs(self.outer_circle.get_radius()))
rmax = max(numpy.fabs(self.inner_circle.get_radius()),
Expand Down
4 changes: 2 additions & 2 deletions src/sas/qtgui/Plotting/Slicers/AzimutSlicer.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def __init__(self, base, axes, color='black', zorder=3):
def _post_data(self):
"""
"""
from sas.sascalc.dataloader.manipulations import SectorQ
from sasdata.data_util.manipulations import SectorQ
self.post_data(SectorQ)


Expand All @@ -261,6 +261,6 @@ def __init__(self, base, axes, color='black', zorder=3):
def _post_data(self):
"""
"""
from sas.sascalc.dataloader.manipulations import SectorPhi
from sasdata.data_util.manipulations import SectorPhi
self.post_data(SectorPhi)

4 changes: 2 additions & 2 deletions src/sas/qtgui/Plotting/Slicers/BoxSlicer.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ def _post_data(self):
"""
Post data creating by averaging in Qx direction
"""
from sas.sascalc.dataloader.manipulations import SlabX
from sasdata.data_util.manipulations import SlabX
self.post_data(SlabX, direction="X")

def validate(self, param_name, param_value):
Expand All @@ -510,7 +510,7 @@ def _post_data(self):
"""
Post data creating by averaging in Qy direction
"""
from sas.sascalc.dataloader.manipulations import SlabY
from sasdata.data_util.manipulations import SlabY
self.post_data(SlabY, direction="Y")

def validate(self, param_name, param_value):
Expand Down
3 changes: 1 addition & 2 deletions src/sas/qtgui/Plotting/Slicers/BoxSum.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
from sas.qtgui.Utilities.GuiUtils import formatNumber, toDouble

from sas.qtgui.Plotting.Slicers.BaseInteractor import BaseInteractor
from sas.sascalc.dataloader.manipulations import Boxavg
from sas.sascalc.dataloader.manipulations import Boxsum
from sasdata.data_util.manipulations import Boxavg, Boxsum

from sas.qtgui.Plotting.SlicerModel import SlicerModel

Expand Down
2 changes: 1 addition & 1 deletion src/sas/qtgui/Plotting/Slicers/SectorSlicer.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def _post_data(self, nbins=None):
if data is None:
return
# Averaging
from sas.sascalc.dataloader.manipulations import SectorQ
from sasdata.data_util.manipulations import SectorQ
radius = self.qmax
phimin = -self.left_line.phi + self.main_line.theta
phimax = self.left_line.phi + self.main_line.theta
Expand Down
16 changes: 8 additions & 8 deletions src/sas/qtgui/Utilities/FileConverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@

from PyQt5 import QtWidgets, QtCore, QtGui

from sas.sascalc.file_converter.ascii2d_loader import ASCII2DLoader
from sas.sascalc.file_converter.nxcansas_writer import NXcanSASWriter
from sas.sascalc.dataloader.data_info import Data1D
from sasdata.file_converter.ascii2d_loader import ASCII2DLoader
from sasdata.file_converter.nxcansas_writer import NXcanSASWriter
from sasdata.dataloader.data_info import Data1D

from sas.sascalc.dataloader.data_info import Detector
from sas.sascalc.dataloader.data_info import Sample
from sas.sascalc.dataloader.data_info import Source
from sas.sascalc.dataloader.data_info import Vector
from sasdata.dataloader.data_info import Detector
from sasdata.dataloader.data_info import Sample
from sasdata.dataloader.data_info import Source
from sasdata.dataloader.data_info import Vector

import sas.sascalc.file_converter.FileConverterUtilities as Utilities
import sasdata.file_converter.FileConverterUtilities as Utilities

import sas.qtgui.Utilities.GuiUtils as GuiUtils
from sas.qtgui.Utilities.FrameSelect import FrameSelect
Expand Down
16 changes: 8 additions & 8 deletions src/sas/qtgui/Utilities/GuiUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
from sas.qtgui.Plotting.PlotterData import Data1D
from sas.qtgui.Plotting.PlotterData import Data2D
from sas.qtgui.Plotting.Plottables import Plottable
from sas.sascalc.dataloader.data_info import Sample, Source, Vector
from sas.sascalc.dataloader.data_info import Detector, Process, TransmissionSpectrum
from sas.sascalc.dataloader.data_info import Aperture, Collimation
from sasdata.dataloader.data_info import Sample, Source, Vector
from sasdata.dataloader.data_info import Detector, Process, TransmissionSpectrum
from sasdata.dataloader.data_info import Aperture, Collimation
from sas.qtgui.Plotting.Plottables import View
from sas.qtgui.Plotting.Plottables import PlottableTheory1D
from sas.qtgui.Plotting.Plottables import PlottableFit1D
Expand All @@ -44,8 +44,8 @@
from sas.sascalc.fit.AbstractFitEngine import FitData1D, FitData2D
from sasmodels.sasview_model import SasviewModel

from sas.sascalc.dataloader.loader import Loader
from sas.sascalc.file_converter.nxcansas_writer import NXcanSASWriter
from sasdata.dataloader.loader import Loader
from sasdata.file_converter.nxcansas_writer import NXcanSASWriter

from sas.qtgui.Utilities import CustomDir

Expand Down Expand Up @@ -783,11 +783,11 @@ def onTXTSave(data, path):
reader = None
append_format = len(path.split(".")) == 1
if isinstance(data, Data1D):
from sas.sascalc.dataloader.readers.ascii_reader import Reader as ASCIIReader
from sasdata.dataloader.readers.ascii_reader import Reader as ASCIIReader
path += ".txt" if append_format else ""
reader = ASCIIReader()
elif isinstance(data, Data2D):
from sas.sascalc.dataloader.readers.red2d_reader import Reader as Red2DReader
from sasdata.dataloader.readers.red2d_reader import Reader as Red2DReader
path += ".dat" if append_format else ""
reader = Red2DReader()
if reader:
Expand Down Expand Up @@ -1442,7 +1442,7 @@ def readProjectFromSVS(filepath):
"""
Read old SVS file and convert to the project dictionary
"""
from sas.sascalc.dataloader.readers.cansas_reader import Reader as CansasReader
from sasdata.dataloader.readers.cansas_reader import Reader as CansasReader
from sas.sascalc.fit.pagestate import Reader

loader = Loader()
Expand Down
Loading

0 comments on commit 3d56736

Please sign in to comment.