Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
2148679
Added k-planes model
cedriclim1 Apr 15, 2026
c299ca8
Added PPLR stuff
cedriclim1 Apr 15, 2026
9ac27a9
object_models optimization setting is working well. Only thing that n…
cedriclim1 Apr 15, 2026
5f40d5a
Optimizing, set_optimizer is just default to Adam now, probably need …
cedriclim1 Apr 16, 2026
7f51dc5
KPlanes Tilted claude implementation, need to talk to Corneel. Things…
cedriclim1 Apr 16, 2026
af140be
Added TV loss for PPLR models, I don't like this solution though will…
cedriclim1 Apr 16, 2026
04bd1dc
Merge branch 'electronmicroscopy:dev' into optmixin_pplr
cedriclim1 Apr 16, 2026
73c0d30
object_models.py now has tv_loss for both KPlanes and INR architectur…
cedriclim1 Apr 16, 2026
35157fb
KPlanes with R9+SVD parameterization, everything seems to be working …
cedriclim1 Apr 17, 2026
1c89ad5
Everything seems to be working; only things to do is to take a look a…
cedriclim1 Apr 17, 2026
4215d6e
New TV loss function
cedriclim1 Apr 17, 2026
aebf801
TV volume -- needs significant refactoring everywhere
cedriclim1 Apr 18, 2026
2579847
DDP Fixes for PPLR stuff
cedriclim1 Apr 19, 2026
a59baac
Changes
cedriclim1 Apr 22, 2026
251f3fb
Reorganizing tensor decomposition methods. Defined a new TensorDecomp…
cedriclim1 Apr 23, 2026
e33fec1
Removed some the _unwrap dependencies. Added ObjectTensorDecomp on to…
cedriclim1 Apr 23, 2026
15bdcd4
Revamped model_base.py to cover type-hinting stuff. KPlanes has a set…
cedriclim1 Apr 23, 2026
0c71a5d
Final changes prior to draft PR
cedriclim1 Apr 23, 2026
99fdd88
Fixed typo
cedriclim1 Apr 24, 2026
4a44826
Small change to set_optimizer in OptimizerMixin to allow for dictiona…
cedriclim1 Apr 24, 2026
ede9d56
Pretraining warning on ObjectTensorDecomp
cedriclim1 Apr 24, 2026
dc0b5f0
Doing some refactoring, adding reconstruction context to help with ty…
cedriclim1 Apr 27, 2026
01456ed
Working on ObjectPixelated implementing ctx
cedriclim1 Apr 27, 2026
a061845
Added pyrightconfig.json to gitignore, PrivateImportUsage error annoying
cedriclim1 Apr 27, 2026
23cfd72
ObjectINR implemented
cedriclim1 Apr 27, 2026
fb07d14
Claude OptimizerMixin changes to account for different optimizable pa…
cedriclim1 Apr 27, 2026
6678c43
Moved ReconContext, changed get_optimization_parameters in dataset_mo…
cedriclim1 Apr 27, 2026
9a96415
Small changes
cedriclim1 Apr 28, 2026
e444164
Merge branch 'dev' of github.com:electronmicroscopy/quantem into optm…
cedriclim1 Apr 28, 2026
8ecd3c7
converting ptycho models to work with new PPLR
arthurmccray May 7, 2026
adcc26d
Created a BaseContext class - totally optional, not sure if anyone us…
cedriclim1 May 18, 2026
044f446
Merge branch 'optmixin_pplr' of github.com:electronmicroscopy/quantem…
cedriclim1 May 18, 2026
af33b96
Removed import in constraints.py
cedriclim1 May 18, 2026
03da610
PPLR description changed to multi-parameter optimization
cedriclim1 May 18, 2026
a62295c
SO3 Rotations paper citation in SO3params.py
cedriclim1 May 18, 2026
e222512
Type-hinting fix in So3params
cedriclim1 May 18, 2026
91d6056
Load parameters added .to(self.device)
cedriclim1 May 18, 2026
f37ca9f
Volume added to reconstruction context
cedriclim1 May 18, 2026
8072fa6
Citations for the kplanes models
cedriclim1 May 18, 2026
eafca0c
Explanation in object_models.py for different types of tv loss.
cedriclim1 May 18, 2026
e4c8dbe
Refactor type hinting in _unwrap function to use cast for improved ty…
cedriclim1 May 18, 2026
136a65f
Some type-hinting fix for Contexts
cedriclim1 May 18, 2026
990f35d
SO3Params switched to static methods.
cedriclim1 May 28, 2026
c56994a
Fixed optimizer_params using hidden variable in set_optimizer
cedriclim1 May 28, 2026
4b8ca47
Added more description to the ReconstructionContext
cedriclim1 May 28, 2026
1bc1739
Standardized optimizer params with new normalization to always output…
cedriclim1 May 28, 2026
21944c4
Standardized optimizer params with new normalization to always output…
cedriclim1 May 28, 2026
e11e49e
Fixed some bugs with DEFAULT_OPTIMIZER_KEY not being instantiated in …
cedriclim1 May 28, 2026
b2e9e15
Working version, standardized optimizer_mixin.py
cedriclim1 May 29, 2026
bf19e60
Removed .md and .html files
cedriclim1 May 29, 2026
91642a8
Major changes per Claude's detailed report on what I actually impleme…
cedriclim1 May 29, 2026
c5f8b37
Warnings to no optimizations on PtychographyDatasetBase.
cedriclim1 May 29, 2026
15f22b9
fixing OptimizerParamsType refactor, and changing SchedulerParamsType…
arthurmccray Jun 1, 2026
14a1463
Tomography tests, and bug-fix on get_optimization_parameters in Tomog…
cedriclim1 Jun 1, 2026
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# BasedPyRight Config
pyrightconfig.json

# Ruff stuff:
.ruff_cache/

Expand Down
1 change: 1 addition & 0 deletions src/quantem/__init__.py
Comment thread
arthurmccray marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from pkgutil import extend_path

__path__ = extend_path(__path__, __name__)

from importlib.metadata import version
Expand Down
17 changes: 13 additions & 4 deletions src/quantem/core/ml/constraints.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
from abc import ABC, abstractmethod
from copy import deepcopy
from dataclasses import dataclass
from typing import Any, Self
from typing import Any, Generic, Self, TypeVar

import numpy as np
import torch
from numpy.typing import NDArray


@dataclass
class BaseContext(ABC):
"""
Constraints should contain a context object that contains all necessary data for the constraints to be applied.
"""
pass

T_ctx = TypeVar("T_ctx", bound=BaseContext)

@dataclass(slots=False)
class Constraints(ABC):
"""
Expand Down Expand Up @@ -47,7 +56,7 @@ def __str__(self) -> str:
)


class BaseConstraints(ABC):
class BaseConstraints(ABC, Generic[T_ctx]):
"""
Base class for constraints.
"""
Expand Down Expand Up @@ -86,14 +95,14 @@ def constraints(self, constraints: Constraints | dict[str, Any]):

# --- Required methods tha tneeds to implemented in subclasses ---
@abstractmethod
def apply_hard_constraints(self, *args, **kwargs) -> torch.Tensor:
def apply_hard_constraints(self, pred: torch.Tensor) -> torch.Tensor:
"""
Apply hard constraints to the model.
"""
raise NotImplementedError

@abstractmethod
def apply_soft_constraints(self, *args, **kwargs) -> torch.Tensor:
def apply_soft_constraints(self, ctx: T_ctx) -> torch.Tensor:
"""
Apply soft constraints to the model.
"""
Expand Down
Empty file.
Loading