diff --git a/.gitignore b/.gitignore index e69de29..8346749 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/Quest-1.1.tar.gz diff --git a/0001-Fix-tab-mixing.patch b/0001-Fix-tab-mixing.patch new file mode 100644 index 0000000..63dff19 --- /dev/null +++ b/0001-Fix-tab-mixing.patch @@ -0,0 +1,34 @@ +From 7a09c41c0244b751101ada26f0353451a5a13b23 Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Sat, 12 Dec 2015 16:01:01 +0100 +Subject: [PATCH 1/5] Fix tab mixing + +Signed-off-by: Igor Gnatenko +--- + src/Quest.py | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/Quest.py b/src/Quest.py +index 9d101ce..f84a8b4 100644 +--- a/src/Quest.py ++++ b/src/Quest.py +@@ -458,13 +458,13 @@ def demo(): + tTest=tTest+random.choice([-0.1,0,0.1]) + + # Simulate a trial +- timeSplit=time.time(); # omit simulation and printing from reported time/trial. ++ timeSplit=time.time(); # omit simulation and printing from reported time/trial. + response=q.simulate(tTest,tActual) + print 'Trial %3d at %4.1f is %s'%(k+1,tTest,wrongRight[int(response)]) +- timeZero=timeZero+time.time()-timeSplit; ++ timeZero=timeZero+time.time()-timeSplit; + + # Update the pdf +- q.update(tTest,response); ++ q.update(tTest,response); + + # Print results of timing. + print '%.0f ms/trial'%(1000*(time.time()-timeZero)/trialsDesired) +-- +2.6.4 + diff --git a/0002-py3-print_function.patch b/0002-py3-print_function.patch new file mode 100644 index 0000000..6858b62 --- /dev/null +++ b/0002-py3-print_function.patch @@ -0,0 +1,79 @@ +From 0f0d556de276531609ac50de58c8067fcf93cf86 Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Sat, 12 Dec 2015 16:02:08 +0100 +Subject: [PATCH 2/5] py3: print_function + +Signed-off-by: Igor Gnatenko +--- + src/Quest.py | 20 +++++++++++--------- + 1 file changed, 11 insertions(+), 9 deletions(-) + +diff --git a/src/Quest.py b/src/Quest.py +index f84a8b4..751b277 100644 +--- a/src/Quest.py ++++ b/src/Quest.py +@@ -31,6 +31,8 @@ + # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + # DAMAGE. + ++from __future__ import print_function ++ + __all__ = ['QuestObject'] + + import math +@@ -169,7 +171,7 @@ class QuestObject: + iBetaMean=num.sum(p2/beta2)/p + iBetaSd=math.sqrt(num.sum(p2/beta2**2)/p-(num.sum(p2/beta2)/p)**2) + stream.write('%5.2f %5.2f %4.1f %4.1f %6.3f\n'%(t,sd,1/iBetaMean,betaSd,self.gamma)) +- print 'Now re-analyzing with beta as a free parameter. . . .' ++ print('Now re-analyzing with beta as a free parameter. . . .') + if stream is None: + stream=sys.stdout + stream.write('logC sd beta sd gamma\n'); +@@ -418,7 +420,7 @@ def demo(): + psychometric method. Percept Psychophys, 33 (2), 113-20. + """ + +- print 'The intensity scale is abstract, but usually we think of it as representing log contrast.' ++ print('The intensity scale is abstract, but usually we think of it as representing log contrast.') + + tActual = None + while tActual is None: +@@ -460,27 +462,27 @@ def demo(): + # Simulate a trial + timeSplit=time.time(); # omit simulation and printing from reported time/trial. + response=q.simulate(tTest,tActual) +- print 'Trial %3d at %4.1f is %s'%(k+1,tTest,wrongRight[int(response)]) ++ print('Trial %3d at %4.1f is %s'%(k+1,tTest,wrongRight[int(response)])) + timeZero=timeZero+time.time()-timeSplit; + + # Update the pdf + q.update(tTest,response); + + # Print results of timing. +- print '%.0f ms/trial'%(1000*(time.time()-timeZero)/trialsDesired) ++ print('%.0f ms/trial'%(1000*(time.time()-timeZero)/trialsDesired)) + + # Get final estimate. + t=q.mean() + sd=q.sd() +- print 'Mean threshold estimate is %4.2f +/- %.2f'%(t,sd) ++ print('Mean threshold estimate is %4.2f +/- %.2f'%(t,sd)) + #t=QuestMode(q); + #print 'Mode threshold estimate is %4.2f'%t + +- print '\nQuest beta analysis. Beta controls the steepness of the Weibull function.\n' ++ print('\nQuest beta analysis. Beta controls the steepness of the Weibull function.\n') + q.beta_analysis() +- print 'Actual parameters of simulated observer:' +- print 'logC beta gamma' +- print '%5.2f %4.1f %5.2f'%(tActual,q.beta,q.gamma) ++ print('Actual parameters of simulated observer:') ++ print('logC beta gamma') ++ print('%5.2f %4.1f %5.2f'%(tActual,q.beta,q.gamma)) + + if __name__ == '__main__': + demo() # run the demo +-- +2.6.4 + diff --git a/0003-py3-raw_input.patch b/0003-py3-raw_input.patch new file mode 100644 index 0000000..194180e --- /dev/null +++ b/0003-py3-raw_input.patch @@ -0,0 +1,46 @@ +From a758ce0876e6a0ab0dc54c91d7c286ea9a53e96a Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Sat, 12 Dec 2015 16:03:05 +0100 +Subject: [PATCH 3/5] py3: raw_input + +Signed-off-by: Igor Gnatenko +--- + src/Quest.py | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +diff --git a/src/Quest.py b/src/Quest.py +index 751b277..5c7500d 100644 +--- a/src/Quest.py ++++ b/src/Quest.py +@@ -425,18 +425,24 @@ def demo(): + tActual = None + while tActual is None: + sys.stdout.write('Specify true threshold of simulated observer: ') +- input = raw_input() + try: +- tActual = float(input) ++ inp = raw_input() ++ except NameError: ++ inp = input() ++ try: ++ tActual = float(inp) + except: + pass + + tGuess = None + while tGuess is None: + sys.stdout.write('Estimate threshold: ') +- input = raw_input() + try: +- tGuess = float(input) ++ inp = raw_input() ++ except NameError: ++ inp = input() ++ try: ++ tGuess = float(inp) + except: + pass + +-- +2.6.4 + diff --git a/0004-rename-to-visionegg-quest.patch b/0004-rename-to-visionegg-quest.patch new file mode 100644 index 0000000..21ae762 --- /dev/null +++ b/0004-rename-to-visionegg-quest.patch @@ -0,0 +1,26 @@ +From 12ba2743f8aa5e6d08d00fa81de8c39aa0057f02 Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Sat, 12 Dec 2015 16:08:00 +0100 +Subject: [PATCH 4/5] rename to visionegg-quest + +Signed-off-by: Igor Gnatenko +--- + setup.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/setup.py b/setup.py +index c975dfc..759e8ec 100644 +--- a/setup.py ++++ b/setup.py +@@ -2,7 +2,7 @@ + from distutils.core import setup + + setup( +- name='Quest', ++ name='visionegg-quest', + version='1.1', + description = "QUEST algorithm for finding threshold", + author = "Dennis Pelli", +-- +2.6.4 + diff --git a/0005-remove-bool-constants-hack.patch b/0005-remove-bool-constants-hack.patch new file mode 100644 index 0000000..212f1c5 --- /dev/null +++ b/0005-remove-bool-constants-hack.patch @@ -0,0 +1,31 @@ +From e9cc83b63e8f54caf219114e4eeff99bc3772a6a Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Sat, 12 Dec 2015 16:11:14 +0100 +Subject: [PATCH 5/5] remove bool constants hack + +Signed-off-by: Igor Gnatenko +--- + src/Quest.py | 7 ------- + 1 file changed, 7 deletions(-) + +diff --git a/src/Quest.py b/src/Quest.py +index 5c7500d..c5143f0 100644 +--- a/src/Quest.py ++++ b/src/Quest.py +@@ -47,13 +47,6 @@ import numpy as num + def getinf(x): + return num.nonzero( num.isinf( num.atleast_1d(x) ) ) + +-# Use Python's bool constants if available, make aliases if not +-try: +- True +-except NameError: +- True = 1==1 +- False = 1==0 +- + class QuestObject: + + """Measure threshold using a Weibull psychometric function. +-- +2.6.4 + diff --git a/python-visionegg-quest.spec b/python-visionegg-quest.spec new file mode 100644 index 0000000..4c35e08 --- /dev/null +++ b/python-visionegg-quest.spec @@ -0,0 +1,89 @@ +%global modname visionegg-quest +%global srcname Quest + +# https://fedoraproject.org/wiki/Packaging:DistTag?rd=Packaging/DistTag#Conditionals +%if 0%{?fedora} < 30 +%global with_py2 1 +%else +%global with_py2 0 +%endif + +Name: python-%{modname} +Version: 1.1 +Release: 2%{?dist} +Summary: QUEST algorithm for finding threshold + +License: BSD +URL: http://visionegg.readthedocs.org/en/latest/Quest.html +Source0: http://downloads.sourceforge.net/visionegg/%{srcname}-%{version}.tar.gz +Patch0: 0001-Fix-tab-mixing.patch +Patch1: 0002-py3-print_function.patch +Patch2: 0003-py3-raw_input.patch +Patch3: 0004-rename-to-visionegg-quest.patch +Patch4: 0005-remove-bool-constants-hack.patch + +BuildArch: noarch + +%description +%{summary}. + +%if %{with_py2} +%package -n python2-%{modname} +Summary: %{summary} +%{?python_provide:%python_provide python2-%{modname}} +BuildRequires: python2-devel +Requires: %{py2_dist numpy} + +%description -n python2-%{modname} +%{summary}. + +Python 2 version. +%endif + +%package -n python3-%{modname} +Summary: %{summary} +%{?python_provide:%python_provide python3-%{modname}} +BuildRequires: python3-devel +Requires: %{py3_dist numpy} + +%description -n python3-%{modname} +%{summary}. + +Python 3 version. + +%prep +%autosetup -n %{srcname}-%{version} -p1 + +%build +%if %{with_py2} +%py2_build +%endif + +%py3_build + +%install +%if %{with_py2} +%py2_install +%endif + +%py3_install + +%if %{with_py2} +%files -n python2-%{modname} +%{python2_sitelib}/visionegg_quest-*.egg-info +%{python2_sitelib}/%{srcname}.py* +%endif + +%files -n python3-%{modname} +%{python3_sitelib}/visionegg_quest-*.egg-info +%{python3_sitelib}/%{srcname}.py +%{python3_sitelib}/__pycache__/%{srcname}.* + +%changelog +* Sat Nov 03 2018 Ankur Sinha - 1.1-2 +- Initial import +- Use conditional to disable py2 builds on F30+ +- Use pyX_dist macro + +* Sat Dec 12 2015 Igor Gnatenko - 1.1-1 +- Initial package diff --git a/sources b/sources index e69de29..b5fd2da 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +SHA512 (Quest-1.1.tar.gz) = 88ad60ab3cc7be7c5b393b39c4eccb055cc43d53335d58c50fb11125c36fb53bc8c17f08dfc7ee08fd5f9d4baa2a734c9eee57dd310c5dd2ae820abed88f6f9c