Skip to content
Merged
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
3 changes: 3 additions & 0 deletions .github/workflows/documentation-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ jobs:
- name: Upgrade pip
run: |
python -m pip install --upgrade pip
- name: Force upgrade of sphinx-rtd-theme to build documentation, not compatible with docutils 0.20.1
run: |
pip install --upgrade --force-reinstall sphinx-rtd-theme
- name: Set up Python
uses: actions/setup-python@v5
with:
Expand Down
4 changes: 2 additions & 2 deletions Examples/fitting/plot_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
This example shows the usages of the different constraints.
"""

from easyscience.Fitting import Constraints
from easyscience.fitting import Constraints
from easyscience.Objects.ObjectClasses import Parameter

p1 = Parameter('p1', 1)
Expand All @@ -15,7 +15,7 @@
p1.value = value
print(f'Set Value: {value}, Parameter Value: {p1}')

#%%
# %%
# To include embedded rST, use a line of >= 20 ``#``'s or ``#%%`` between your
# rST and your code. This separates your example
# into distinct text and code blocks. You can continue writing code below the
Expand Down
2 changes: 1 addition & 1 deletion docs/src/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = 'en'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/getting-started/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The easiest way of obtaining EasyScience and using it in your project is via pip
$ pip install EasyScience

Install as an EasyScience developer
--------------------------------
-----------------------------------

You can obtain the latest development source from our `Github repository
<https://github.com/easyScience/EasyScience>`_.:
Expand Down
8 changes: 4 additions & 4 deletions docs/src/reference/base.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ Parameters and Objects
Descriptors
===========

.. autoclass:: easyscience.Objects.Base.Descriptor
.. autoclass:: easyscience.Objects.Variable.Descriptor
:members:

Parameters
==========

.. autoclass:: easyscience.Objects.Base.Parameter
.. autoclass:: easyscience.Objects.Variable.Parameter
:members:
:inherited-members:

Expand All @@ -22,11 +22,11 @@ Super Classes and Collections
Super Classes
=============

.. autoclass:: easyscience.Objects.Base.BasedBase
.. autoclass:: easyscience.Objects.ObjectClasses.BasedBase
:members:
:inherited-members:

.. autoclass:: easyscience.Objects.Base.BaseObj
.. autoclass:: easyscience.Objects.ObjectClasses.BaseObj
:members: +_add_component
:inherited-members:

Expand Down
2 changes: 1 addition & 1 deletion examples_old/example1.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import numpy as np

from easyscience.Fitting import Fitter
from easyscience.fitting import Fitter
from easyscience.Objects.ObjectClasses import BaseObj
from easyscience.Objects.ObjectClasses import Parameter

Expand Down
2 changes: 1 addition & 1 deletion examples_old/example1_dream.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import numpy as np

from easyscience.Fitting import Fitter
from easyscience.fitting import Fitter
from easyscience.Objects.ObjectClasses import BaseObj
from easyscience.Objects.ObjectClasses import Parameter

Expand Down
2 changes: 1 addition & 1 deletion examples_old/example2.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import numpy as np

from easyscience.Fitting import Fitter
from easyscience.fitting import Fitter
from easyscience.Objects.ObjectClasses import BaseObj
from easyscience.Objects.ObjectClasses import Parameter

Expand Down
2 changes: 1 addition & 1 deletion examples_old/example3.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import numpy as np

from easyscience.Fitting import Fitter
from easyscience.fitting import Fitter
from easyscience.Objects.ObjectClasses import BaseObj
from easyscience.Objects.ObjectClasses import Parameter

Expand Down
2 changes: 1 addition & 1 deletion examples_old/example4.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import numpy as np

from easyscience import global_object
from easyscience.Fitting import Fitter
from easyscience.fitting import Fitter
from easyscience.Objects.core import ComponentSerializer
from easyscience.Objects.ObjectClasses import BaseObj
from easyscience.Objects.ObjectClasses import Parameter
Expand Down
2 changes: 1 addition & 1 deletion examples_old/example5_broken.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import numpy as np

from easyscience import global_object
from easyscience.Fitting import Fitter
from easyscience.fitting import Fitter
from easyscience.Objects.Base import BaseObj
from easyscience.Objects.Base import Parameter
from easyscience.Objects.core import ComponentSerializer
Expand Down
2 changes: 1 addition & 1 deletion examples_old/example_dataset2.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import numpy as np
from easyscience.Datasets.xarray import xr
from easyscience.Fitting import Fitter
from easyscience.fitting import Fitter
from easyscience.Objects.ObjectClasses import BaseObj
from easyscience.Objects.ObjectClasses import Parameter

Expand Down
2 changes: 1 addition & 1 deletion examples_old/example_dataset2pt2.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import numpy as np
from easyscience.Datasets.xarray import xr
from easyscience.Fitting import Fitter
from easyscience.fitting import Fitter
from easyscience.Objects.ObjectClasses import BaseObj
from easyscience.Objects.ObjectClasses import Parameter

Expand Down
2 changes: 1 addition & 1 deletion examples_old/example_dataset2pt2_broken.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import numpy as np
from easyscience.Datasets.xarray import xr
from easyscience.Fitting import Fitter
from easyscience.fitting import Fitter
from easyscience.Objects.Base import BaseObj
from easyscience.Objects.Base import Parameter

Expand Down
2 changes: 1 addition & 1 deletion examples_old/example_dataset3.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import numpy as np
from easyscience.Datasets.xarray import xr
from easyscience.Fitting import Fitter
from easyscience.fitting import Fitter
from easyscience.Objects.ObjectClasses import BaseObj
from easyscience.Objects.ObjectClasses import Parameter

Expand Down
2 changes: 1 addition & 1 deletion examples_old/example_dataset3pt2.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import numpy as np
from easyscience.Datasets.xarray import xr
from easyscience.Fitting import Fitter
from easyscience.fitting import Fitter
from easyscience.Objects.ObjectClasses import BaseObj
from easyscience.Objects.ObjectClasses import Parameter

Expand Down
2 changes: 1 addition & 1 deletion examples_old/example_dataset4.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import numpy as np
from easyscience.Datasets.xarray import xr
from easyscience.Fitting import Fitter
from easyscience.fitting import Fitter
from easyscience.Objects.ObjectClasses import BaseObj
from easyscience.Objects.ObjectClasses import Parameter

Expand Down
2 changes: 1 addition & 1 deletion examples_old/example_dataset4_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import numpy as np
from easyscience.Datasets.xarray import xr
from easyscience.Fitting import Fitter
from easyscience.fitting import Fitter
from easyscience.Objects.ObjectClasses import BaseObj
from easyscience.Objects.ObjectClasses import Parameter

Expand Down
5 changes: 2 additions & 3 deletions src/easyscience/Datasets/xarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,14 +281,13 @@ def sigma_generator(

:param variable_label: Name of the DataArray to perform the calculation on
:type variable_label: str
:param sigma_func: Function to generate the sigmas. Must be of the form f(x) and return an array of the same
shape as the input. DEFAULT: sqrt(|data|)
:param sigma_func: Function to generate the sigmas. Must be of the form f(x) and return an array of the same shape as the input. Default sqrt(\|x\|)
:type sigma_func: Callable
:param label_prefix: What prefix should be used to designate a sigma DataArray from a data DataArray
:type label_prefix: str
:return: None
:rtype: None
"""
""" # noqa: E501
sigma_values = sigma_func(self._obj[variable_label])
self.sigma_attach(variable_label, sigma_values, label_prefix)

Expand Down
6 changes: 3 additions & 3 deletions src/easyscience/Objects/Groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
from easyscience.Objects.ObjectClasses import Descriptor

if TYPE_CHECKING:
from easyscience.Utils.typing import B
from easyscience.Utils.typing import V
from easyscience.Utils.typing import iF
from easyscience.Objects.Inferface import iF
from easyscience.Objects.ObjectClasses import B
from easyscience.Objects.Variable import V


class BaseCollection(BasedBase, MutableSequence):
Expand Down
6 changes: 3 additions & 3 deletions src/easyscience/Objects/ObjectClasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
from .Variable import Parameter

if TYPE_CHECKING:
from easyscience.Utils.typing import C
from easyscience.Utils.typing import V
from easyscience.Utils.typing import iF
from easyscience.fitting.Constraints import C
from easyscience.Objects.Inferface import iF
from easyscience.Objects.Variable import V


class BasedBase(ComponentSerializer):
Expand Down
2 changes: 1 addition & 1 deletion src/easyscience/Objects/Variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from easyscience.Utils.Exceptions import CoreSetException

if TYPE_CHECKING:
from easyscience.Utils.typing import C
from easyscience.fitting.Constraints import C

Q_ = ureg.Quantity
M_ = ureg.Measurement
Expand Down
20 changes: 9 additions & 11 deletions src/easyscience/Objects/virtual.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from easyscience.fitting.Constraints import ObjConstraint

if TYPE_CHECKING:
from easyscience.Utils.typing import BV
from easyscience.Objects.ObjectClasses import BV


def raise_(ex):
Expand Down Expand Up @@ -48,7 +48,7 @@ def realizer(obj: BV):
args = []
if klass in ec_var.__dict__.values(): # is_variable check
kwargs = obj.encode_data()
kwargs["unique_name"] = None
kwargs['unique_name'] = None
return klass(**kwargs)
else:
kwargs = {name: realizer(item) for name, item in obj._kwargs.items()}
Expand Down Expand Up @@ -97,9 +97,7 @@ def component_realizer(obj: BV, component: str, recursive: bool = True):
key = value.unique_name
if getattr(value, '__old_class__', value.__class__) in ec_var.__dict__.values():
continue
component._global_object.map.prune_vertex_from_edge(
component, component._kwargs[key]
)
component._global_object.map.prune_vertex_from_edge(component, component._kwargs[key])
component._global_object.map.add_edge(component, old_component._kwargs[key])
component._kwargs[key] = old_component._kwargs[key]
done_mapping = False
Expand Down Expand Up @@ -142,12 +140,12 @@ def virtualizer(obj: BV) -> BV:
# The supplied class
klass = getattr(obj, '__old_class__', obj.__class__)
virtual_options = {
"_is_virtual": True,
"is_virtual": property(fget=lambda self: self._is_virtual),
"_derived_from": property(fget=lambda self: obj.unique_name),
"__non_virtual_class__": klass,
"realize": realizer,
"relalize_component": component_realizer,
'_is_virtual': True,
'is_virtual': property(fget=lambda self: self._is_virtual),
'_derived_from': property(fget=lambda self: obj.unique_name),
'__non_virtual_class__': klass,
'realize': realizer,
'relalize_component': component_realizer,
}

import easyscience.Objects.Variable as ec_var
Expand Down
28 changes: 14 additions & 14 deletions src/easyscience/Utils/classTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

from __future__ import annotations

__author__ = "github.com/wardsimon"
__version__ = "0.1.0"
__author__ = 'github.com/wardsimon'
__version__ = '0.1.0'

from typing import TYPE_CHECKING
from typing import List
Expand All @@ -15,15 +15,15 @@
from easyscience.global_object.hugger.property import LoggedProperty

if TYPE_CHECKING:
from easyscience.Utils.typing import BV
from easyscience.Utils.typing import B
from easyscience.Objects.ObjectClasses import BV
from easyscience.Objects.ObjectClasses import B


def addLoggedProp(inst: BV, name: str, *args, **kwargs) -> None:
cls = type(inst)
annotations = getattr(cls, "__annotations__", False)
if not hasattr(cls, "__perinstance"):
cls = type(cls.__name__, (cls,), {"__module__": inst.__module__})
annotations = getattr(cls, '__annotations__', False)
if not hasattr(cls, '__perinstance'):
cls = type(cls.__name__, (cls,), {'__module__': inst.__module__})
cls.__perinstance = True
if annotations:
cls.__annotations__ = annotations
Expand All @@ -34,9 +34,9 @@ def addLoggedProp(inst: BV, name: str, *args, **kwargs) -> None:

def addProp(inst: BV, name: str, *args, **kwargs) -> None:
cls = type(inst)
annotations = getattr(cls, "__annotations__", False)
if not hasattr(cls, "__perinstance"):
cls = type(cls.__name__, (cls,), {"__module__": __name__})
annotations = getattr(cls, '__annotations__', False)
if not hasattr(cls, '__perinstance'):
cls = type(cls.__name__, (cls,), {'__module__': __name__})
cls.__perinstance = True
if annotations:
cls.__annotations__ = annotations
Expand All @@ -48,8 +48,8 @@ def addProp(inst: BV, name: str, *args, **kwargs) -> None:

def removeProp(inst: BV, name: str) -> None:
cls = type(inst)
if not hasattr(cls, "__perinstance"):
cls = type(cls.__name__, (cls,), {"__module__": __name__})
if not hasattr(cls, '__perinstance'):
cls = type(cls.__name__, (cls,), {'__module__': __name__})
cls.__perinstance = True
inst.__old_class__ = inst.__class__
inst.__class__ = cls
Expand All @@ -65,8 +65,8 @@ def generatePath(model_obj: B, skip_first: bool = False) -> Tuple[List[int], Lis
for par in pars:
elem = par.unique_name
route = global_object.map.reverse_route(elem, model_id)
objs = [getattr(global_object.map.get_item_by_key(r), "name") for r in route]
objs = [getattr(global_object.map.get_item_by_key(r), 'name') for r in route]
objs.reverse()
names.append(".".join(objs[start_idx:]))
names.append('.'.join(objs[start_idx:]))
ids.append(elem.int)
return ids, names
2 changes: 1 addition & 1 deletion src/easyscience/Utils/io/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import numpy as np

if TYPE_CHECKING:
from easyscience.Utils.typing import BV
from easyscience.Objects.ObjectClasses import BV

_e = json.JSONEncoder()

Expand Down
Loading