Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
9048cb0
refactor features and add hook for dataset features
kecnry Jun 11, 2024
2898409
build features
kecnry Jun 11, 2024
c3c8b0d
use class-defined allowed kinds
kecnry Jun 11, 2024
eaeed6d
WIP to allow in-line custom features
kecnry Jun 13, 2024
3500887
component feature hook for intensities
kecnry Jun 14, 2024
26e3cce
update component hooks to modify_*
kecnry Jun 14, 2024
5f7a6c5
support custom component features
kecnry Jun 14, 2024
8d24636
remove sinusoidal third light from built-ins
kecnry Jun 14, 2024
e684c37
implement support for registering component/dataset features
kecnry Jun 14, 2024
e256ac3
migrate existing features to use parse_bundle
kecnry Jun 14, 2024
e0b40fb
expose register at top-level
kecnry Jun 21, 2024
cb40af8
update class_from_code to specify namespace
kecnry Aug 6, 2025
904ba4b
clarify variable names
kecnry Aug 6, 2025
8b26f27
implement CodeParameter
kecnry Aug 6, 2025
fb180bb
code cleanup
kecnry Aug 6, 2025
76b646d
refactor to have BaseFeature class
kecnry Aug 6, 2025
9507a2b
refactor to allow overloading Spot
kecnry Aug 6, 2025
cbd197d
remove register_feature implementation
kecnry Aug 7, 2025
0a9852a
fix pyproject build
kecnry Aug 7, 2025
4dae8ee
add hook for modify_rvs
kecnry Aug 7, 2025
bf307f2
migrate logic from 2.4.18 bugfix
kecnry Aug 10, 2025
a5853b2
replace rv_offset@dataset with feature implementation
kecnry Aug 10, 2025
2741fbb
parse_feature_from_ps to take feature_ps
kecnry Aug 11, 2025
a0361ff
code cleanup
kecnry Aug 11, 2025
7b17833
rename feature_code to custom_code
kecnry Aug 11, 2025
9337bc3
support DatasetFeature.modify_data_for_estimators
kecnry Aug 11, 2025
2ff5605
use class-structure for built-in features
kecnry Aug 12, 2025
50680f6
update list_available_features
kecnry Aug 13, 2025
ec33de6
support writing compute_checks in feature classes
kecnry Aug 13, 2025
e150aae
fix (some) failing tests
kecnry Aug 14, 2025
4cd0284
remove protocoords switch and control remeshing in method
kecnry Aug 14, 2025
94092a7
fix failing GPs test
kecnry Aug 14, 2025
1af17d7
ComponentFeature access to cartesian_to_spherical method
kecnry Aug 14, 2025
9c6829f
simplify modify_intensities hook
kecnry Aug 14, 2025
7b0db2c
give features access to logger
kecnry Aug 14, 2025
265c626
Fixes angular array wrapping.
aprsa Jun 2, 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
4 changes: 2 additions & 2 deletions phoebe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ def progressbars(self):
from . import dynamics as dynamics
from . import distortions as distortions
from . import algorithms as algorithms
from . import features as features
import libphoebe

# Shortcut to building logger
Expand Down Expand Up @@ -882,7 +883,6 @@ def add_distl_docstring(obj):
add_distl_docstring(uniform_around)
add_distl_docstring(gaussian_around)


# expose available "kinds" per-context
def _get_phoebe_funcs(module, devel=False):
ignore = ['_empty_array', 'deepcopy', 'fnmatch',
Expand Down Expand Up @@ -949,7 +949,7 @@ def list_available_features(devel=False):
---------
* (list of strings)
"""
return _get_phoebe_funcs(feature, devel=devel)
return list(feature._feature_classes.keys())

def list_available_datasets(devel=False):
"""
Expand Down
14 changes: 1 addition & 13 deletions phoebe/backend/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -1173,12 +1173,7 @@ def _run_single_time(self, b, i, time, infolist, **kwargs):
kind=kind,
components=info['component'])

rv = obs['rv'] + b.get_value(qualifier='rv_offset',
component=info['component'],
dataset=info['dataset'],
context='dataset',
unit=u.solRad/u.d,
**_skip_filter_checks)
rv = obs['rv']
else:
# then rv_method == 'dynamical'
rv = -1*vzi[cind]
Expand Down Expand Up @@ -1608,13 +1603,6 @@ def mqtf(value, direction=None):
phb1.setpar(proximity_par, rv_method=='flux-weighted')

rvs = np.array(rv_call(tuple(info['times'].tolist()), rvind))
rvs += b.get_value(qualifier='rv_offset',
component=info['component'],
dataset=info['dataset'],
context='dataset',
unit=u.km/u.s,
**_skip_filter_checks)

packetlist.append(_make_packet('rvs',
rvs*u.km/u.s,
None,
Expand Down
1 change: 1 addition & 0 deletions phoebe/backend/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -1320,6 +1320,7 @@ def _place_in_orbit(self, pos, vel, euler, euler_vel, rotation_vel=(0,0,0), comp
# let's store the position. This is both useful for "undoing" the
# orbit-offset, and also eventually to allow incremental changes.
self._pos = pos
self._vel = vel
if component_com_x is not None and component_com_x != 0.0:
self._pos_center = transform_position_array(np.array([component_com_x, 0.0, 0.0]), pos, euler, False)
else:
Expand Down
390 changes: 47 additions & 343 deletions phoebe/backend/universe.py

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions phoebe/features/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from .dataset_features import *
from .component_features import *
44 changes: 44 additions & 0 deletions phoebe/features/common.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import logging
logger = logging.getLogger("FEATURES")
logger.addHandler(logging.NullHandler())


__all__ = ['BaseFeature']


class BaseFeature:
def __init__(self, **kwargs):
self.kwargs = kwargs
self.logger = logger

@classmethod
def create_feature_parameters(self, feature_ps, **kwargs):
raise NotImplementedError("create_feature_parameters must be implemented in the feature subclass")

@classmethod
def parse_from_feature_ps(cls, b, feature_ps, param_list):
_skip_filter_checks = {'check_default': False,
'check_visible': False,
'check_advanced': False}

def item_to_kwargs(item):
if isinstance(item, str):
item = {'qualifier': item}
if not isinstance(item, dict):
raise TypeError("items in param_list must be qualifiers or dictionaries")
return item

kws = [item_to_kwargs(item) for item in param_list]
return {kw['qualifier']: feature_ps.get_value(**kw, **_skip_filter_checks) for kw in kws}

@classmethod
def parse_bundle(cls, b, feature_ps):
return {}

@classmethod
def _from_bundle(cls, b, feature_ps):
return cls(**cls.parse_bundle(b, feature_ps))

@classmethod
def run_checks_compute(cls, b, feature_ps, compute_ps):
return [{}]
Loading
Loading