Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating function in FindStat interface #19296

Closed
stumpc5 opened this issue Sep 26, 2015 · 158 comments
Closed

Generating function in FindStat interface #19296

stumpc5 opened this issue Sep 26, 2015 · 158 comments

Comments

@stumpc5
Copy link
Contributor

stumpc5 commented Sep 26, 2015

This ticket implements the generating function pull from a FindStat statistic and its search in the OEIS.

It also fixes some issues recently discovered, in particular #19543

CC: @mantepse

Component: packages: optional

Keywords: FindStat, OEIS

Work Issues: document

Author: Christian Stump, Martin Rubey

Branch/Commit: 15ec356

Reviewer: Martin Rubey, Christian Stump

Issue created by migration from https://trac.sagemath.org/ticket/19296

@stumpc5 stumpc5 added this to the sage-6.9 milestone Sep 26, 2015
@stumpc5
Copy link
Contributor Author

stumpc5 commented Sep 26, 2015

@stumpc5
Copy link
Contributor Author

stumpc5 commented Sep 26, 2015

Changed keywords from none to FindStat, OEIS

@stumpc5

This comment has been minimized.

@stumpc5
Copy link
Contributor Author

stumpc5 commented Sep 26, 2015

Commit: eefeaae

@stumpc5
Copy link
Contributor Author

stumpc5 commented Sep 26, 2015

New commits:

eefeaaefirst version for generating function and automated oeis search, still to be improved

@stumpc5
Copy link
Contributor Author

stumpc5 commented Sep 26, 2015

Author: Christian Stump

@stumpc5
Copy link
Contributor Author

stumpc5 commented Sep 26, 2015

Work Issues: document

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 26, 2015

Branch pushed to git repo; I updated commit sha1. New commits:

0a69285cosmetic

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 26, 2015

Changed commit from eefeaae to 0a69285

@stumpc5
Copy link
Contributor Author

stumpc5 commented Sep 26, 2015

comment:4

@mantepse, do I need to add the utf8 encoding in

self._generating_function = self._raw[FINDSTAT_STATISTIC_GENERATING_FUNCTION]

as in some of the other similar lines before?

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 27, 2015

Changed commit from 0a69285 to b0eda28

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 27, 2015

Branch pushed to git repo; I updated commit sha1. New commits:

b0eda28remved a leftover print command

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 27, 2015

Branch pushed to git repo; I updated commit sha1. New commits:

6640df6added name_plural method

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 27, 2015

Changed commit from b0eda28 to 6640df6

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 27, 2015

Changed commit from 6640df6 to e1b0c89

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 27, 2015

Branch pushed to git repo; I updated commit sha1. New commits:

e1b0c89added verbose and improved the oeis search

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 27, 2015

Branch pushed to git repo; I updated commit sha1. New commits:

9926f7fadded max length to oeis search

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 27, 2015

Changed commit from e1b0c89 to 9926f7f

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 27, 2015

Branch pushed to git repo; I updated commit sha1. New commits:

83d5332improved max length to oeis search

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 27, 2015

Changed commit from 9926f7f to 83d5332

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 28, 2015

Changed commit from 83d5332 to f544c28

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 28, 2015

Branch pushed to git repo; I updated commit sha1. New commits:

ea11793added list of coefficient option to generating functions
595e289added some documentation
f544c28added name to json and pull it from there

@mantepse
Copy link
Collaborator

comment:11

I think it would be better to have the commits added name to json and pull it from there and added name_plural method in a separate ticket. Actually, I even have a bug to fix...

@stumpc5
Copy link
Contributor Author

stumpc5 commented Sep 29, 2015

comment:12

@mantepse If I now push the new collections.json without the CollectionLevelsPrecomputed field. Is then the current version of the interface braking? I guess so, right?

@stumpc5
Copy link
Contributor Author

stumpc5 commented Sep 29, 2015

comment:13

Replying to @mantepse:

I think it would be better to have the commits added name to json and pull it from there and added name_plural method in a separate ticket. Actually, I even have a bug to fix...

We can do that if you want...

@stumpc5
Copy link
Contributor Author

stumpc5 commented Sep 29, 2015

comment:14

Replying to @stumpc5:

Replying to @mantepse:

I think it would be better to have the commits added name to json and pull it from there and added name_plural method in a separate ticket. Actually, I even have a bug to fix...

We can do that if you want...

This is now #19307.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 29, 2015

Branch pushed to git repo; I updated commit sha1. New commits:

44da776cleaned the statistic name method
836f205improved statistic name, added collection name plural, some cosmetic changes as well
b95a704Merge branch 't/19307/improve_statistic_name_and_add_collection_name_plural_to_findstat_interface' into t/19296/generating_function_in_findstat_interface
cde7b5bremoved everything that is now in #19307

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 10, 2015

Branch pushed to git repo; I updated commit sha1. New commits:

1c83fe3tiny fixes

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 10, 2015

Changed commit from 72877fa to 1c83fe3

@mantepse
Copy link
Collaborator

comment:103

I'm giving the parts Christian wrote positive review.

@mantepse
Copy link
Collaborator

Changed author from Christian Stump to Christian Stump, Martin Rubey

@mantepse
Copy link
Collaborator

Changed reviewer from Martin Rubey to Martin Rubey, Christian Stump

@stumpc5
Copy link
Contributor Author

stumpc5 commented Nov 10, 2015

comment:105

looks good to me, and the patchbot is happy...

@jdemeyer
Copy link

comment:106

This is silly:

try:
    assert foo
except AssertionError:
    raise ValueError(...)

it would be much better to write this is

if not foo:
    raise ValueError(...)

but really, I think you also want to catch TypeError from the depth = int(depth) call.

You should also add doctests for these bad inputs.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 11, 2015

Branch pushed to git repo; I updated commit sha1. New commits:

4620683Merge branch 'develop' of git://github.com/sagemath/sage into t/19296/generating_function_in_findstat_interface
fd221b7better argument checking due to jdemeyer

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 11, 2015

Changed commit from 1c83fe3 to fd221b7

@mantepse
Copy link
Collaborator

comment:108

Do you like this version better? (I want to keep the argument checking of depth short and as one entity, that's why I did it this way.)

@jdemeyer
Copy link

comment:110

Fine for me.

Please remember that you should never use except:, as it is usually the wrong thing to do (it also catches KeyboardInterrupt for example).

@vbraun
Copy link
Member

vbraun commented Nov 12, 2015

comment:111

Doctests must run without network access

sage -t --long src/sage/databases/findstat.py
**********************************************************************
File "src/sage/databases/findstat.py", line 486, in sage.databases.findstat.FindStat.__call__
Failed example:
    findstat("Permutations", 1)
Expected:
    Traceback (most recent call last):
    ...
    ValueError: The given arguments, Permutations and 1, cannot be used for a FindStat search.
Got:
    <BLANKLINE>
    Traceback (most recent call last):
      File "/mnt/highperf/buildbot/slave/sage_git/build/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 496, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/mnt/highperf/buildbot/slave/sage_git/build/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 858, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.databases.findstat.FindStat.__call__[3]>", line 1, in <module>
        findstat("Permutations", Integer(1))
      File "sage/misc/lazy_import.pyx", line 383, in sage.misc.lazy_import.LazyImport.__call__ (/mnt/highperf/buildbot/slave/sage_git/build/src/build/cythonized/sage/misc/lazy_import.c:3593)
        return self._get_object()(*args, **kwds)
      File "/mnt/highperf/buildbot/slave/sage_git/build/local/lib/python2.7/site-packages/sage/databases/findstat.py", line 613, in __call__
        (collection, to_str) = get_collection(None, query_1)
      File "/mnt/highperf/buildbot/slave/sage_git/build/local/lib/python2.7/site-packages/sage/databases/findstat.py", line 515, in get_collection
        collection = FindStatCollection(element)
      File "sage/misc/classcall_metaclass.pyx", line 326, in sage.misc.classcall_metaclass.ClasscallMetaclass.__call__ (/mnt/highperf/buildbot/slave/sage_git/build/src/build/cythonized/sage/misc/classcall_metaclass.c:1239)
        return cls.classcall(cls, *args, **kwds)
      File "/mnt/highperf/buildbot/slave/sage_git/build/local/lib/python2.7/site-packages/sage/databases/findstat.py", line 1861, in __classcall_private__
        return FindStatCollections()(entry)
      File "sage/misc/classcall_metaclass.pyx", line 326, in sage.misc.classcall_metaclass.ClasscallMetaclass.__call__ (/mnt/highperf/buildbot/slave/sage_git/build/src/build/cythonized/sage/misc/classcall_metaclass.c:1239)
        return cls.classcall(cls, *args, **kwds)
      File "sage/misc/cachefunc.pyx", line 1304, in sage.misc.cachefunc.WeakCachedFunction.__call__ (/mnt/highperf/buildbot/slave/sage_git/build/src/build/cythonized/sage/misc/cachefunc.c:8470)
        w = self.f(*args, **kwds)
      File "/mnt/highperf/buildbot/slave/sage_git/build/local/lib/python2.7/site-packages/sage/structure/unique_representation.py", line 1021, in __classcall__
        instance = typecall(cls, *args, **options)
      File "sage/misc/classcall_metaclass.pyx", line 493, in sage.misc.classcall_metaclass.typecall (/mnt/highperf/buildbot/slave/sage_git/build/src/build/cythonized/sage/misc/classcall_metaclass.c:1665)
        return (<PyTypeObject*>type).tp_call(cls, args, kwds)
      File "/mnt/highperf/buildbot/slave/sage_git/build/local/lib/python2.7/site-packages/sage/databases/findstat.py", line 2357, in __init__
        for j in json.load(urlopen(FINDSTAT_URL_DOWNLOADS_COLLECTIONS)):
      File "/mnt/highperf/buildbot/slave/sage_git/build/local/lib/python/urllib2.py", line 154, in urlopen
        return opener.open(url, data, timeout)
      File "/mnt/highperf/buildbot/slave/sage_git/build/local/lib/python/urllib2.py", line 431, in open
        response = self._open(req, data)
      File "/mnt/highperf/buildbot/slave/sage_git/build/local/lib/python/urllib2.py", line 449, in _open
        '_open', req)
      File "/mnt/highperf/buildbot/slave/sage_git/build/local/lib/python/urllib2.py", line 409, in _call_chain
        result = func(*args)
      File "/mnt/highperf/buildbot/slave/sage_git/build/local/lib/python/urllib2.py", line 1227, in http_open
        return self.do_open(httplib.HTTPConnection, req)
      File "/mnt/highperf/buildbot/slave/sage_git/build/local/lib/python/urllib2.py", line 1197, in do_open
        raise URLError(err)
    URLError: <urlopen error [Errno 110] Connection timed out>
**********************************************************************
1 item had failures:
   1 of   6 in sage.databases.findstat.FindStat.__call__
    [54 tests, 1 failure, 127.29 s]

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 12, 2015

Changed commit from fd221b7 to 00dc9e5

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 12, 2015

Branch pushed to git repo; I updated commit sha1. New commits:

04162f7Merge branch 'develop' of git://github.com/sagemath/sage into t/19296/generating_function_in_findstat_interface
00dc9e5Merge branch 'u/mantepse/generating_function_in_findstat_interface' of git://trac.sagemath.org/sage into t/19296/generating_function_in_findstat_interface

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 12, 2015

Changed commit from 00dc9e5 to 15ec356

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 12, 2015

Branch pushed to git repo; I updated commit sha1. New commits:

15ec356fix test thanks to vbraun

@mantepse
Copy link
Collaborator

comment:114

Sorry about that, fixed.

@vbraun
Copy link
Member

vbraun commented Nov 12, 2015

Changed branch from u/mantepse/generating_function_in_findstat_interface to 15ec356

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants