Closed seblabbe closed 4 years ago
Branch pushed to git repo; I updated commit sha1. New commits:
6448d1f | remove obsolete field |
Branch pushed to git repo; I updated commit sha1. New commits:
08fdb3a | fix doc syntax |
Replying to @stumpc5:
Here are some first comments:
""" There is a new collection available at
The Combinatorial Statistic Finder (https://www.findstat.org/)
: Signed permutations. To use it with this interface, it has to be added to the dictionary SupportedFindStatCollections in src/sage/databases/findstat.py of the SageMath distribution. Please open a ticket on trac! """Would it be possible to automatize this? Otherwise, every user will see this on startup and likely get confused.
Unfortunately, support of new collections cannot be made automatic. However, a new collection appears possibly once a year, so it shouldn't be a big problem. I cleaned the message a bit.
- I would prefer a single entry point (maybe
FindStat
withFindStat.find_statistic
andFindStat.find_map
?). If I knowfindstat
but notfindmap
, I might completely miss the latter? Also, usingFindStat?
would immediately give instructions how to proceed.
No, I don't want to do this. If you discover findstat
, I am sure you will discover findstat
, too. Introducing a new layer introduces more typing with very little benefit - it is extremely unlikely that there will be a third item analogous to findstat
and findmap
. To get the tutorial, sage.databases.findstat?
suffices, as with all of sage.
41: St001489oMp00081oMp00059 (quality [100, 100])
The termquality
is not obviously explained. In the doc, it might be referred to as "a number which says how many values...". a proper definition of this quality might be helpful.
The quality is explained in the tutorial, but I agree it should also be explained in findstat?
and findmap?
. Patches welcome.
- The term
distribution
is not explained how to be used in the input section offindstat
: it is twice referred to as "distribution must be None".
Indeed, the documentation of findstat
and findmap
still needs to be improved.
- It remains unclear (I think, to a new user) what "a new statistic" means. I would suggest to not show this as one of the "results" of a
DababaseQuery
. Instead, I would suggest to have this available as a methodsubmit_as_new_statistic
.
- This method fails if the input datum is not a statistic (but a distribution).
- If there is no result, the user gets prompted a message that this method is available in case she wants to submit the data.
Done, with the exception of failing for "distributions", because it is not clear when to fail exactly. I think it is better (and easier) to allow submission in case of doubt.
- The term
offset
is not exlained, is it?
It is now in the tutorial, but should also be explained by findstat?
- What about two methods
matching values
andunmatched_values
?
- Each of these could consist of lists of pairs of the form
( ( elt1, elt2, elt3 ), val )
.
That's non-trivial, and I'd therefore like not to do it now.
- Finally: Since the output might be long and confusing, I think it would be great if
FindStatMatchingStatistic
had a methodinfo
ordetailed_info
or alike which would in detail present this match:
done.
Branch pushed to git repo; I updated commit sha1. New commits:
f52803d | whitespace fixes, remove obsolete code |
I just tried this for the first time and get
sage: findstat(3)
<repr(<sage.databases.findstat.FindStatStatistics_with_category.element_class at 0x1be3bcfc0>) failed: requests.exceptions.SSLError: Can't connect to HTTPS URL because the SSL module is not available.>
What do I do?
It appears that openssl
is not installed on macOS Catalina:
sage: import ssl
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-3-bc7fc2b48773> in <module>()
----> 1 import ssl
/Users/kathrinmeier/sage/local/lib/python3.7/ssl.py in <module>()
96 from enum import Enum as _Enum, IntEnum as _IntEnum, IntFlag as _IntFlag
97
---> 98 import _ssl # if we can't import it, let the error propagate
99
100 from _ssl import OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_INFO, OPENSSL_VERSION
ModuleNotFoundError: No module named '_ssl'
Hi Kathrin! I'm afraid I can't help you here (I am unfamiliar with macOS), maybe you can ask on sage-devel or sage-support. Did you try whether oeis([1,2,5,14,42])
works?
Here is a (very stupid) workaround - but you absolutely have to fix openssl support:
sage: from sage.databases.findstat import FINDSTAT_URL
sage: sage.databases.findstat.FINDSTAT_URL = 'http://www.findstat.org/'
Hi,
unfortunately neither oeis([1,2,5,14,42])
nor your workaround worked.
I even tried
sage -i pip openssl
now but without any new result.
Branch pushed to git repo; I updated commit sha1. New commits:
c09cfc5 | factor out submission |
Replying to @kathrin2006:
Hi, unfortunately neither
oeis([1,2,5,14,42])
nor your workaround worked.I even tried
sage -i pip openssl
now but without any new result.
Installing openssl should be followed by sage -f python
that will rebuild all of sage.
Is the following a bug?
sage: sts = findstat("DyckPaths", [ ( list(DyckWords(n)), [inner_trians(T,n+2) for T in trians(n+2)] ) for n in [2 .. 5] ])
sage: sts.submit()
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-42-ef4ef8d3bffa> in <module>()
----> 1 sts.submit()
/home/stumpcl2/Programs/sage/local/lib/python3.7/site-packages/sage/databases/findstat.py in submit(self, max_values)
2319 else:
2320 url = FINDSTAT_NEWSTATISTIC_FORM_HEADER % (FINDSTAT_URL_EDIT_STATISTIC + self.id_str())
-> 2321 _submit(args, url)
2322
2323 # editing and submitting is really the same thing
/home/stumpcl2/Programs/sage/local/lib/python3.7/site-packages/sage/databases/findstat.py in _submit(args, url)
443 verbose("Created temporary file %s" % f.name, caller_name='FindStat')
444 f.write(FINDSTAT_POST_HEADER)
--> 445 if not int(id_str[2:]):
446 f.write(url_header % url_new)
447 else:
NameError: name 'id_str' is not defined
Also, submit_as_new_statistic
is more explicit than submit
. The docstring says "Open the FindStat web page for editing the statistic in a browser." even though this data is not an existing statistic that can be edited.
The docstring of the method quality
does not explain the tuple of two integers. Should it?
Branch pushed to git repo; I updated commit sha1. New commits:
0a1e60c | doctest _submit, docstring quality, fix docstring submit |
unfortunately, I have a problem with submit, it doesn't do the right thing with line breaks :-(
Branch pushed to git repo; I updated commit sha1. New commits:
5b38d96 | fix py2-3 unicode encoding issue |
Branch pushed to git repo; I updated commit sha1. New commits:
8e2be83 | fix some docstrings and make docbuild pass |
Reviewer: Sébastien Labbé
With sage-9.1.beta2 + this branch, the command
sage -t --optional=sage,internet src/sage/databases/findstat.py
gives
sage -t src/sage/databases/findstat.py
**********************************************************************
File "src/sage/databases/findstat.py", line 49, in sage.databases.findstat
Failed example:
r = findstat([(m, m.number_of_nestings()) for n in range(6) for m in PM(2*n)]); r # optional -- internet
Expected:
0: St000042oMp00116 (quality [100, 100])
1: St000041 (quality [20, 100])
...
Got:
The Combinatorial Statistic Finder (https://www.findstat.org/) provides a new collection:
Cc0026: Decorated permutations
To use it with this interface, it has to be added to the dictionary
_SupportedFindStatCollections in src/sage/databases/findstat.py
of the SageMath distribution. Please open a ticket on trac!
The Combinatorial Statistic Finder (https://www.findstat.org/) provides a new collection:
Cc0025: Plane partitions
To use it with this interface, it has to be added to the dictionary
_SupportedFindStatCollections in src/sage/databases/findstat.py
of the SageMath distribution. Please open a ticket on trac!
0: St000042oMp00116 (quality [100, 100])
1: St000041 (quality [20, 100])
2: St000232oMp00115oMp00092 (quality [17, 70])
3: St000233oMp00092 (quality [16, 100])
4: St000496oMp00092 (quality [16, 100])
5: St000123oMp00087oMp00058 (quality [13, 70])
6: St000359oMp00087oMp00058 (quality [13, 70])
**********************************************************************
1 item had failures:
1 of 16 in sage.databases.findstat
[382 tests, 1 failure, 39.76 s]
----------------------------------------------------------------------
sage -t src/sage/databases/findstat.py # 1 doctest failed
----------------------------------------------------------------------
Moving tickets to milestone sage-9.2 based on a review of last modification date, branch status, and severity.
Merge conflict with 9.2.beta0.
The Combinatorial Statistic Finder (https://www.findstat.org/) provides a new collection:
Cc0026: Decorated permutations
Cc0025: Plane partitions
To use it with this interface, it has to be added to the dictionary
_SupportedFindStatCollections in src/sage/databases/findstat.py
of the SageMath distribution. Please open a ticket on trac!
Description changed:
---
+++
@@ -1,3 +1,4 @@
+Using `SageMath version 9.2.beta2, Release Date: 2020-06-26`, the command
sage -t --optional=sage,internet src/sage/databases/findstat.py @@ -6,40 +7,17 @@ gives
-Using --optional=internet,memlimit,sage
-Doctesting 1 file.
-sage -t --warn-long 69.4 src/sage/databases/findstat.py
**********************************************************************
-File "src/sage/databases/findstat.py", line 2117, in sage.databases.findstat.FindStatCollection.in_range
-Failed example:
- for c in l: # optional -- internet, random
- if c.id() not in long and c.is_supported():
- f = c.first_terms(lambda x: 1, max_values=10000)
- print("{} {} {}".format(c, len(f), all(c.in_range(e) for e, _ in f)))
-Exception raised:
- Traceback (most recent call last):
- File "/home/slabbe/GitBox/sage/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 681, in _run
- self.compile_and_execute(example, compiler, test.globs)
- File "/home/slabbe/GitBox/sage/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 1123, in compile_and_execute
- exec(compiled, globs)
- File "<doctest sage.databases.findstat.FindStatCollection.in_range[8]>", line 3, in <module>
- f = c.first_terms(lambda x: Integer(1), max_values=Integer(10000))
- File "/home/slabbe/GitBox/sage/local/lib/python3.7/site-packages/sage/databases/findstat.py", line 2174, in first_terms
- return [(x, statistic(x)) for (x,_) in zip(g, range(max_values))]
- File "/home/slabbe/GitBox/sage/local/lib/python3.7/site-packages/sage/databases/findstat.py", line 2174, in <listcomp>
- return [(x, statistic(x)) for (x,_) in zip(g, range(max_values))]
- File "/home/slabbe/GitBox/sage/local/lib/python3.7/site-packages/sage/databases/findstat.py", line 2170, in <genexpr>
- g = (x for n in self._levels.keys() for x in self._sageconstructor(n))
- File "/home/slabbe/GitBox/sage/local/lib/python3.7/site-packages/sage/databases/findstat.py", line 2453, in <lambda>
- 19: [None, None, None, SemistandardTableau, lambda x: SemistandardTableaux(x),
- File "sage/misc/classcall_metaclass.pyx", line 334, in sage.misc.classcall_metaclass.ClasscallMetaclass.__call__ (build/cythonized/sage/misc/classcall_metaclass.c:1741)
- return cls.classcall(cls, *args, **kwds)
- File "/home/slabbe/GitBox/sage/local/lib/python3.7/site-packages/sage/combinat/tableau.py", line 5941, in __classcall_private__
- raise ValueError( "shape must be a (skew) partition" )
- ValueError: shape must be a (skew) partition
-**********************************************************************
-
+7 items had failures:
+ 4 of 16 in sage.databases.findstat
+ 3 of 10 in sage.databases.findstat.FindStat
+ 1 of 11 in sage.databases.findstat.FindStat.__call__
+ 1 of 10 in sage.databases.findstat.FindStatCollection.in_range
+ 3 of 5 in sage.databases.findstat.FindStatStatistic.first_terms
+ 3 of 5 in sage.databases.findstat.FindStatStatistic.generating_functions
+ 2 of 4 in sage.databases.findstat.FindStatStatistic.oeis_search
+ [249 tests, 17 failures, 41.24 s]
----------------------------------------------------------------------
-sage -t --warn-long 69.4 src/sage/databases/findstat.py # 1 doctests failed
+sage -t src/sage/databases/findstat.py # 17 doctests failed
----------------------------------------------------------------------
Updating the description of the ticket to mention the 17 failing doctests.
Testing the current branch, I get only one doctest failure copied below:
sage -t src/sage/databases/findstat.py
**********************************************************************
File "src/sage/databases/findstat.py", line 49, in sage.databases.findstat
Failed example:
r = findstat([(m, m.number_of_nestings()) for n in range(6) for m in PM(2*n)]); r # optional -- internet
Expected:
0: St000042oMp00116 (quality [100, 100])
1: St000041 (quality [20, 100])
...
Got:
The Combinatorial Statistic Finder (https://www.findstat.org/) provides a new collection:
Cc0026: Decorated permutations
To use it with this interface, it has to be added to the dictionary
_SupportedFindStatCollections in src/sage/databases/findstat.py
of the SageMath distribution. Please open a ticket on trac!
The Combinatorial Statistic Finder (https://www.findstat.org/) provides a new collection:
Cc0025: Plane partitions
To use it with this interface, it has to be added to the dictionary
_SupportedFindStatCollections in src/sage/databases/findstat.py
of the SageMath distribution. Please open a ticket on trac!
0: St000042oMp00116 (quality [100, 100])
1: St000041 (quality [20, 100])
2: St000232oMp00115oMp00092 (quality [17, 70])
3: St000233oMp00092 (quality [16, 100])
4: St000496oMp00092 (quality [16, 100])
5: St000123oMp00087oMp00058 (quality [13, 70])
6: St000359oMp00087oMp00058 (quality [13, 70])
**********************************************************************
1 item had failures:
1 of 16 in sage.databases.findstat
[382 tests, 1 failure, 46.16 s]
----------------------------------------------------------------------
sage -t src/sage/databases/findstat.py # 1 doctest failed
----------------------------------------------------------------------
Tell me when this needs review again or change the status to needs review.
Branch pushed to git repo; I updated commit sha1. New commits:
3ec989b | Merge branch 'develop' into t/28864/1_internet_doctest_failing_in_findstat_py |
Branch pushed to git repo; I updated commit sha1. New commits:
cdf2c22 | more fixes for edge labels, cgi is replaced with html |
Branch pushed to git repo; I updated commit sha1. New commits:
b25802a | accept FindStatStatistic and FindStatMap for values and distribution |
Branch pushed to git repo; I updated commit sha1. New commits:
2d6b266 | Merge branch 'develop' of git://trac.sagemath.org/sage into t/28864/1_internet_doctest_failing_in_findstat_py |
f540af8 | Merge branch 'u/mantepse/1_internet_doctest_failing_in_findstat_py' of git://trac.sagemath.org/sage into t/28864/1_internet_doctest_failing_in_findstat_py |
578ebcb | Merge branch 'u/mantepse/1_internet_doctest_failing_in_findstat_py' of git://trac.sagemath.org/sage into t/28864/1_internet_doctest_failing_in_findstat_py |
d7fbbf9 | add missing dictionary entry |
Branch pushed to git repo; I updated commit sha1. New commits:
dec07aa | support decorated permutations |
Branch pushed to git repo; I updated commit sha1. New commits:
bdefdf2 | fix doctest of hash |
findstat.org has now a proper api. In this ticket we switch to this api, and create a hierarchy of classes that better models what findstat provides.
In particular, this allows search for maps, iterating over all statistics or maps with given domain, easier access to search for distributions, etc.
Restricted to the capabilities of the old interface, the usage remains the same.
We also fix all the failing doctest.
Original ticket description
Using
SageMath version 9.2.beta2, Release Date: 2020-06-26
, the commandgives
CC: @mantepse @stumpc5
Component: combinatorics
Keywords: FindStat
Author: Martin Rubey
Branch/Commit:
52c576e
Reviewer: Sébastien Labbé
Issue created by migration from https://trac.sagemath.org/ticket/28864