Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
61f2b3a
added mask input to sensitivity map and test its shape
Jammy2211 Oct 9, 2024
0996f8e
docstring
Jammy2211 Oct 9, 2024
5b4afb5
jobs skipped
Jammy2211 Oct 9, 2024
119fb8c
added instance to fit __call__
Jammy2211 Oct 9, 2024
915983c
fix test
rhayes777 Oct 11, 2024
3a51aa7
illustrating issue
rhayes777 Oct 11, 2024
7608c86
masked job result
rhayes777 Oct 11, 2024
d68e0ff
extracted bypass function
rhayes777 Oct 11, 2024
71b8bfd
make a job for a number
rhayes777 Oct 11, 2024
3600955
implemented dummy result mechanism
rhayes777 Oct 11, 2024
8d8e3da
fix
rhayes777 Oct 11, 2024
7666a65
fix
rhayes777 Oct 11, 2024
875e96e
remove bypass check from job creation
rhayes777 Oct 11, 2024
bd93666
docs
rhayes777 Oct 11, 2024
8715751
Merge branch 'main' into feature/sensitivity_mask
rhayes777 Oct 16, 2024
bb8e4cc
fixture
rhayes777 Oct 16, 2024
f025d3d
model for masked result
rhayes777 Oct 16, 2024
e14ea07
default likelihood and evidence
rhayes777 Oct 16, 2024
6cea6f7
give model perturbation
rhayes777 Oct 16, 2024
1e6652a
with_limits implementation for uniform prior
rhayes777 Oct 16, 2024
e517a07
illustrate x,y,etc params available from perturb model
rhayes777 Oct 16, 2024
fd01def
with limits for log gaussian prior
rhayes777 Oct 16, 2024
653e948
abstract with_limits
rhayes777 Oct 16, 2024
8045f8e
remove test
rhayes777 Oct 16, 2024
2aaf47a
path value dicts
rhayes777 Oct 16, 2024
1fefff2
pass a path value dict to results
rhayes777 Oct 16, 2024
49e6b5d
Revert "pass a path value dict to results"
rhayes777 Oct 16, 2024
2c6a8be
test_perturbed_physical_centres_list_from
rhayes777 Oct 16, 2024
1e324b6
fix tests
rhayes777 Oct 16, 2024
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
2 changes: 1 addition & 1 deletion autofit/example/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def save_attributes(self, paths: af.DirectoryPaths):
Parameters
----------
paths
The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored,
The paths object which manages all paths, e.g. where the non-linear search outputs are stored,
visualization, and the pickled objects used by the aggregator output by this function.
"""
paths.save_json(name="data", object_dict=self.data.tolist(), prefix="dataset")
Expand Down
8 changes: 4 additions & 4 deletions autofit/example/visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def visualize_before_fit(
analysis
The analysis class used to perform the model-fit whose quantities are being visualized.
paths
The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored,
The paths object which manages all paths, e.g. where the non-linear search outputs are stored,
visualization, and the pickled objects used by the aggregator output by this function.
model
The model which is fitted to the data, which may be used to customize the visualization.
Expand Down Expand Up @@ -84,7 +84,7 @@ def visualize(
analysis
The analysis class used to perform the model-fit whose quantities are being visualized.
paths
The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored,
The paths object which manages all paths, e.g. where the non-linear search outputs are stored,
visualization, and the pickled objects used by the aggregator output by this function.
instance
An instance of the model that is being fitted to the data by this analysis (whose parameters have been set
Expand Down Expand Up @@ -163,7 +163,7 @@ def visualize_before_fit_combined(
analyses
A list of the analysis classes used to perform the model-fit whose quantities are being visualized.
paths
The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored,
The paths object which manages all paths, e.g. where the non-linear search outputs are stored,
visualization, and the pickled objects used by the aggregator output by this function.
model
The model which is fitted to the data, which may be used to customize the visualization.
Expand Down Expand Up @@ -202,7 +202,7 @@ def visualize_combined(
analyses
A list of the analysis classes used to perform the model-fit whose quantities are being visualized.
paths
The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored,
The paths object which manages all paths, e.g. where the non-linear search outputs are stored,
visualization, and the pickled objects used by the aggregator output by this function.
model
The model which is fitted to the data, which may be used to customize the visualization.
Expand Down
7 changes: 1 addition & 6 deletions autofit/mapper/prior/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,11 @@ def new(self):
new.id = next(self._ids)
return new

@abstractmethod
def with_limits(self, lower_limit: float, upper_limit: float) -> "Prior":
"""
Create a new instance of the same prior class with the passed limits.
"""
new = self.__class__(
lower_limit=max(lower_limit, self.lower_limit),
upper_limit=min(upper_limit, self.upper_limit),
)
new.message = self.message
return new

@property
def factor(self):
Expand Down
31 changes: 31 additions & 0 deletions autofit/mapper/prior/log_gaussian.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,37 @@ def __init__(
id_=id_,
)

@classmethod
def with_limits(cls, lower_limit: float, upper_limit: float) -> "LogGaussianPrior":
"""
Create a new gaussian prior centred between two limits
with sigma distance between this limits.

Note that these limits are not strict so exceptions will not
be raised for values outside of the limits.

This function is typically used in prior passing, where the
result of a model-fit are used to create new Gaussian priors
centred on the previously estimated median PDF model.

Parameters
----------
lower_limit
The lower limit of the new Gaussian prior.
upper_limit
The upper limit of the new Gaussian Prior.

Returns
-------
A new GaussianPrior
"""
return cls(
mean=(lower_limit + upper_limit) / 2,
sigma=upper_limit - lower_limit,
lower_limit=lower_limit,
upper_limit=upper_limit,
)

def _new_for_base_message(self, message):
"""
Create a new instance of this wrapper but change the parameters used
Expand Down
16 changes: 13 additions & 3 deletions autofit/mapper/prior/uniform.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@ def __init__(
def tree_flatten(self):
return (self.lower_limit, self.upper_limit), (self.id,)

def with_limits(
self,
lower_limit: float,
upper_limit: float,
) -> "Prior":
return UniformPrior(
lower_limit=lower_limit,
upper_limit=upper_limit,
)

def logpdf(self, x):
# TODO: handle x as a numpy array
if x == self.lower_limit:
Expand Down Expand Up @@ -97,9 +107,9 @@ def value_for(self, unit: float, ignore_prior_limits: bool = False) -> float:

physical_value = prior.value_for(unit=0.2)
"""
return float(round(
super().value_for(unit, ignore_prior_limits=ignore_prior_limits), 14
))
return float(
round(super().value_for(unit, ignore_prior_limits=ignore_prior_limits), 14)
)

def log_prior_from_value(self, value):
"""
Expand Down
2 changes: 1 addition & 1 deletion autofit/non_linear/analysis/visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def should_visualize(
Parameters
----------
paths
The PyAutoFit paths object which manages all paths, e.g. where the non-linear search outputs are stored,
The paths object which manages all paths, e.g. where the non-linear search outputs are stored,
visualization and the pickled objects used by the aggregator output by this function.

Returns
Expand Down
Loading