Skip to content

Commit

Permalink
Fix for bug in functionSetIndices; prep for version 1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
perwin committed Sep 17, 2024
1 parent dfe165c commit 5625b15
Show file tree
Hide file tree
Showing 7 changed files with 1,611 additions and 1,517 deletions.
25 changes: 23 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,29 @@

(Formatting and design based on Olivier Lacan's [Keep a CHANGELOG](http://keepachangelog.com/))

**NOTE:** PyImfit is currently in a state of fairly rapid development; minor-version-number
changes may contain significant changes to the API.

# 1.0.2 -- 2024-09-xx

### Fixed
Update to descriptions.py to correctly index individual function sets (where there are multiple
function sets, with one or more having multiple functions). Thanks to Zuyi Chen for identifying
the problem and suggesting the fix.



## 1.0.1 -- 2024-07-20
Official "1.0" release; no dramatic changes from 0.13.

## Added
Conda packages for macOS and Linux (Python versions 3.10--3.12).

Pre-compiled versions for macOS now include binaries for Apple silicon as well as Intel CPUs.

### Changed
No longer supporting Python 3.7.

Minor updates to documentation.



## 0.13.0 -- 2024-04-27
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# The short X.Y version
version = '1.0'
# The full version, including alpha/beta/rc tags
release = '1.0.1'
release = '1.0.2'


# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion pyimfit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
imageFunctionList = get_function_list()
imageFunctionDict = get_function_dict()

__version__ = "1.0.1"
__version__ = "1.0.2"
48 changes: 48 additions & 0 deletions pyimfit/data/config_imfit_multiset.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# config file for imfit: multiple function sets with multiple functions
# this is for testing purposes and is not meant to represent a meaningful model

GAIN 1000

X0 40 35,45
Y0 40 35,45
FUNCTION Gaussian
PA 0 fixed
ell 0 fixed
I_0 105 20,150
sigma 1.5 0.5,2.5

X0 10 35,45
Y0 10 35,45
FUNCTION Gaussian
PA 0 fixed
ell 0 fixed
I_0 25 20,150
sigma 5 0.5,2.5
FUNCTION Exponential
PA 0
ell 0.5
I_0 500
h 10

X0 15 10,20
Y0 10 5,15
FUNCTION Gaussian
PA 0 fixed
ell 0 fixed
I_0 95 20,150
sigma 1.5 0.5,2.5
FUNCTION Gaussian
PA 0 fixed
ell 0 fixed
I_0 95 20,150
sigma 1.5 0.5,2.5
FUNCTION FlatSky
I_0 100.0 fixed

X0 35 10,20
Y0 10 5,15
FUNCTION Exponential
PA 0
ell 0.5
I_0 500
h 10
4 changes: 3 additions & 1 deletion pyimfit/descriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,9 @@ def functionSetIndices(self):
indices = [0]
for i in range(self.nFunctionSets - 1):
functionsThisSet = self._functionSets[i].functionList()
indices.append(len(functionsThisSet))
# code suggested by Zuyi Chen
indices.append(indices[-1] + len(functionsThisSet))
# indices.append(len(functionsThisSet))
return indices


Expand Down
3,038 changes: 1,527 additions & 1,511 deletions pyimfit/pyimfit_lib.cpp

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion pyimfit/tests/test_descriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

CONFIG_EXAMPLE_EXPONENTIAL = "../data/config_exponential_ic3478_256.dat"
CONFIG_EXAMPLE_2SETS = "../data/config_imfit_2gauss_small.dat"

CONFIG_EXAMPLE_MULTISET = "../data/config_imfit_multiset.dat"


class TestParameterDescription(object):
Expand Down Expand Up @@ -733,6 +733,13 @@ def test_getModelAsDict(self):
modelDict = modeldesc_from_dict.getModelAsDict()
assert modelDict == modelDict_correct

def test_functionSetIndices(self):
# test that we generate correct functionSetIndices when there are > 1 function sets, some
# with multiple functions
modeldesc = ModelDescription.load(CONFIG_EXAMPLE_MULTISET)
assert modeldesc.functionSetIndices() == [0, 1, 3, 6]



class TestSimpleModelDescription(object):

Expand Down

0 comments on commit 5625b15

Please sign in to comment.