Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/build_installer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ jobs:
run: |
conda init bash
conda activate rascal2
conda install conda-forge::expat==2.7.3
if [ ${{ matrix.platform }} == "macos-14" ]; then
ARCH="arm64"
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/Users/runner/hostedtoolcache/MATLAB/2023.2.999/arm64/MATLAB.app/bin/maca64
Expand Down
1 change: 1 addition & 0 deletions environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ dependencies:
- python=3.10
- pip
- llvm-openmp
- expat=2.7.3
- pip:
- -r requirements.txt
- -r requirements-dev.txt
8 changes: 3 additions & 5 deletions packaging/linux/build_installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,13 @@ echo ""
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O "$TMP_DIR/miniconda.sh"
bash ./miniconda.sh -b -p ./miniconda
./miniconda/bin/conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main --channel https://repo.anaconda.com/pkgs/r
./miniconda/bin/conda create -n rascal_builder -y python=3.10
./miniconda/bin/conda create -n rascal_builder -y python=3.10 expat=2.7.3

echo ""
echo "Downloading Dependencies"
echo ""
python_exec="./miniconda/envs/rascal_builder/bin/python"
mv "$TMP_DIR/rascal/wheels" "wheels"
mkdir "$TMP_DIR/packages"
$python_exec -m pip download -r "./rascal/requirements.txt" --dest "$TMP_DIR/packages"

Expand All @@ -135,17 +136,14 @@ if [ -z "$NOMATLAB" ]; then
$python_exec -m pip install matlabengine==9.14.*
fi

# workaround for centos 7
#$python_exec -m pip download --only-binary=":all:" --platform="manylinux_2_17_x86_64" --dest "$TMP_DIR/packages" pillow==9.2

echo ""
echo "Compressing Package.tar.gz ..."
echo ""

STAGE_DIR="$TMP_DIR/stage"
mkdir "$STAGE_DIR"

mv -t "$STAGE_DIR" "rascal" "miniconda/envs" "packages"
mv -t "$STAGE_DIR" "rascal" "miniconda/envs" "packages" "wheels"
chmod 777 "$STAGE_DIR/rascal/packaging/linux/install.sh"

echo ""
Expand Down
59 changes: 53 additions & 6 deletions rascal2/widgets/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,46 @@ def __init__(self, parent):
self.add_tab(plot_type, plot_widget)

self.sync_and_update_model()
self.plot_tabs.addTab(self.create_confidence_table(), "Parameter values")
layout.addWidget(self.plot_tabs)
self.setLayout(layout)
self.setModal(True)
self.resize(900, 600)
self.setWindowTitle("Bayes Results")
self.plot_tabs.currentChanged.connect(self.redraw_panel_plot)

def create_confidence_table(self):
"""Create table to display the confidence intervals."""
results = self.parent.presenter.model.results
if results is None:
return

table = QtWidgets.QTableWidget()
table.setColumnCount(4)
table.setRowCount(len(results.fitNames))
table.setHorizontalHeaderLabels(["Parameter", "Mean", "95% CI", "65% CI"])
table.horizontalHeader().setSectionResizeMode(QtWidgets.QHeaderView.ResizeMode.Stretch)
table.verticalHeader().hide()

ci = results.confidenceIntervals
for i, name in enumerate(results.fitNames):
table.setItem(i, 0, QtWidgets.QTableWidgetItem(name))
item1 = QtWidgets.QTableWidgetItem(f"{ci.mean[0][i]:g}")
item1.setTextAlignment(QtCore.Qt.AlignmentFlag.AlignHCenter)
table.setItem(i, 1, item1)

item2 = QtWidgets.QTableWidgetItem(f"[{ci.percentile95[0][i]:g}, {ci.percentile95[1][i]:g}]")
item2.setTextAlignment(QtCore.Qt.AlignmentFlag.AlignHCenter)
table.setItem(i, 2, item2)

item3 = QtWidgets.QTableWidgetItem(f"[{ci.percentile65[0][i]:g}, {ci.percentile65[1][i]:g}]")
item3.setTextAlignment(QtCore.Qt.AlignmentFlag.AlignHCenter)
table.setItem(i, 3, item3)

table.resizeColumnsToContents()

return table

def add_tab(self, plot_type: str, plot_widget: "AbstractPlotWidget"):
"""Add a widget as a tab to the plot widget.

Expand Down Expand Up @@ -233,6 +266,7 @@ def __init__(self, parent):
self.setMinimumSize(500, 300)

scroll_area = QtWidgets.QScrollArea(self)
scroll_area.viewport().setAutoFillBackground(False)
scroll_area.setWidget(self.canvas)
scroll_area.setWidgetResizable(True)

Expand Down Expand Up @@ -323,7 +357,10 @@ def make_figure(self) -> matplotlib.figure.Figure:
The figure to plot onto.

"""
return matplotlib.figure.Figure(figsize=(9, 6))
figure = matplotlib.figure.Figure(figsize=(9, 6))
figure.set_tight_layout(True)
figure.set_tight_layout({"pad": 0.01, "w_pad": 0.5})
return figure

@abstractmethod
def plot(self, project: ratapi.Project, results: ratapi.outputs.Results | ratapi.outputs.BayesResults):
Expand Down Expand Up @@ -388,19 +425,17 @@ def make_toolbar_widget(self):
self.slider = QtWidgets.QSlider(QtCore.Qt.Orientation.Vertical)
self.slider.setTracking(False)
self.slider.setInvertedAppearance(True)
self.slider.setMinimum(1)
self.slider.setMinimum(0)
self.slider.setMaximum(100)
self.slider.setValue(1)
self.slider.setValue(0)
self.slider.valueChanged.connect(self.handle_control_changed)

return self.slider

def make_figure(self) -> matplotlib.figure.Figure:
self.resize_timer = 0
figure = matplotlib.figure.Figure()
figure = super().make_figure()
figure.subplots(1, 2)
figure.set_tight_layout(True)
figure.set_tight_layout({"pad": 0, "w_pad": 0.5})

return figure

Expand Down Expand Up @@ -607,6 +642,18 @@ def make_control_layout(self):

return layout

def make_figure(self) -> matplotlib.figure.Figure:
"""Make the figure to plot onto.

Returns
-------
Figure
The figure to plot onto.

"""
figure = matplotlib.figure.Figure(figsize=(9, 6))
return figure

def make_interaction_layout(self):
"""Make layout with pan, zoom, and reset button."""

Expand Down
5 changes: 4 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
PyInstaller==6.9.0
PyQt6==6.7.1
PyQt6-Qt6==6.7.3
ratapi==0.0.0.dev13
./wheels/ratapi-0.0.0.dev13-cp310-cp310-win_amd64.whl; sys_platform == 'win32'
./wheels/ratapi-0.0.0.dev13-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; sys_platform == 'linux'
./wheels/ratapi-0.0.0.dev13-cp310-cp310-macosx_14_0_x86_64.whl; sys_platform == 'darwin' and platform_machine == 'i386'
./wheels/ratapi-0.0.0.dev13-cp310-cp310-macosx_14_0_arm64.whl; sys_platform == 'darwin' and platform_machine != 'i386'
pydantic==2.8.2
PyQt6-QScintilla==2.14.1
nexusformat==1.0.7
Expand Down
6 changes: 3 additions & 3 deletions tests/widgets/test_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def test_ref_sld_plot_event(mock_plot_sld, sld_widget):
show_error_bar=True,
show_grid=False,
show_legend=True,
shift_value=1,
shift_value=0,
)
sld_widget.canvas.draw.assert_called_once()
data.contrastNames = []
Expand All @@ -137,7 +137,7 @@ def test_ref_sld_plot_event(mock_plot_sld, sld_widget):
show_error_bar=True,
show_grid=False,
show_legend=False,
shift_value=1,
shift_value=0,
)
data.contrastNames = ["Hello"]
sld_widget.x_axis.setCurrentText("Linear")
Expand All @@ -154,7 +154,7 @@ def test_ref_sld_plot_event(mock_plot_sld, sld_widget):
show_error_bar=False,
show_grid=True,
show_legend=False,
shift_value=1,
shift_value=0,
)


Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading