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
Support for one-dimensional shifts of finite type #12996
Comments
Changed keywords from symblic dynamics to symbolic dynamics |
comment:2
Hi Michael, i got the following error : IndentationError: unindent does not match any outer indentation level (finite_type_shift.py, line 2415) One space is missing at line 2415. After fixing this, the tests do pass. Also, don't forget to add yourself on the first page of the trac. |
comment:4
You often wrote
use
instead (notice the colons). You need to add a proper commit message to the patch. |
first version of a class providing support for one-dimensional shifts of finite type |
comment:5
Attachment: trac12996_initial.patch.gz Fixed the indentation error on line 2415. |
comment:7
Hi, I looked very quickly at the code on a friend's computer, and suggest to chqnge the code of the method if logarit == True:
if self._is_empty:
return -Infinity
else:
return log(max([x for x in self._matrix.eigenvalues()
if x in RR]))
elif logarit == False:
if self._is_empty:
return 0
else:
return max([x for x in self._matrix.eigenvalues() if x in RR])
else:
raise ValueError("logarit must be either True or False") to: if self._is_empty:
if logarit:
return -Infinity
else:
return 0
else:
M = max([x for x in self._matrix.eigenvalues() if x in RR])
if logarit:
return log(M)
else:
return M This is simply an example to show how to deal with conditions and booleans. Also, in this case, the value error was not necessary since python will return an error if logarith does not evaluate to a bool. |
Taken care of slabbe's comment (entropy method and boolean handling) |
comment:9
Attachment: trac12996_initial_v1.1.patch.gz I get a warning while building the doc
does it work for you? |
comment:10
Hi, I also get doc building warnings, which (as usual) are due to some minor formatting errors. Otherwise all the tests pass on my sage 5.0.1. I've played quite a lot with the |
comment:11
Hi, thanks for the comments. So what do I have to do now? How can I get rid of the doc build warnings? What else is needed to get a positive review? Replying to @sagetrac-tjolivet:
|
comment:12
How many warnings do you get when building the documentation ? You need to fix all of them. That being said, the warning are not always self-expaining...
After taking a look at the patch, I believe many of the warning are of the same type. Indeed, an empty line is needed before any enumeration. Instead of
you need to write
How many warnings do you get when you add those empty lines before every enumeration? |
comment:13
Hey slabbe, thanks for the comment. I tried it, but still get some docbuild warnings, see below. It appears there are empty lines missing also after certain blocks, but I dont know exactly where. Is there any way to see where exactly they are produced? the numbers seem not to match line numbers in the .py file. Is there any good reference for sphinx or the syntax I should use for SAGE to build the doc without warnings? Very annoying this sphinx thing! Any comment very welcome. Thanks. sphinx-build -b html -d /usr/sage-4.8/devel/sage/doc/output/doctrees/en/reference /usr/sage-4.8/devel/sage/doc/en/reference /usr/sage-4.8/devel/sage/doc/output/html/en/reference Running Sphinx v1.1.2 loading pickled environment... done building [html]: targets for 1 source files that are out of date updating environment: 0 added, 1 changed, 0 removed reading sources... [100%] sage/dynamics/symbolic/finite_type_shift /usr/sage-4.8/local/lib/python2.6/site-packages/sage/dynamics/symbolic/finite_type_shift.py:docstring of sage.dynamics.symbolic.finite_type_shift.SFT.bowen_franks_group:143: WARNING: Inline substitution_reference start-string without end-string. /usr/sage-4.8/local/lib/python2.6/site-packages/sage/dynamics/symbolic/finite_type_shift.py:docstring of sage.dynamics.symbolic.finite_type_shift.SFT.draw_graph:14: WARNING: Inline strong start-string without end-string. looking for now-outdated files... none found pickling environment... done checking consistency... /usr/sage-4.8/devel/sage/doc/en/reference/sage/dynamics/symbolic/finite_type_subshift.rst:: WARNING: document isn't included in any toctree done preparing documents... done writing output... [ 33%] dynamics writing output... [ 66%] index writing output... [100%] sage/dynamics/symbolic/finite_type_shift |
doc errors fixing |
comment:14
Attachment: 12996-docfix-tj.patch.gz Hi, I uploaded a patch which fixes the 18 docbuild errors/warnings I had on my machine (I hope it works on other systems as well). These were quite nasty to find, it can drive one crazy. The most common were : no blank line after at the end of a "-" list of items. There was also the special character sequence that consists of two concatenated "*", which placed alone in text caused problems. I fixed a few other things as well. Having used the patch and analysed it I'd be ready to give it a positive review. Also, one of the most useful and not-too-long-to-implement would be state splittings/amalgamations which are very easy to program using matrix line/columns operations (already in Sage :p). |
comment:15
Yes... it is. The number refers to the line number inside each doctring, but you don't know which... By chance, we write documentation almost always the same way and there are few rules to learn. Here is what I suggest. You first read http://docutils.sourceforge.net/docs/user/rst/quickref.html Then, you practice yourself with the script For example, you copy a doctring between
Then, you call the following command on it :
Now, the number 14 refers really to the line 14 in the file fichier.rst. You may also open the html file to see where is the warning :
You may also copy and paste docstring into this website I just found and never used before : |
comment:16
I now think the empty line is needed after not before any enumeration... sorry. I usually put empty lines before and after...and forgot only after was giving warnings... |
comment:38
Could you please write in the description what tickets have to be applied ? |
This comment has been minimized.
This comment has been minimized.
comment:40
It seems about time to give this ticket a positive review, but why has the patchbot always been refusing to apply the patches? |
comment:41
because you first need to get one patch into Sage for the patchbot to trust you. |
comment:42
I know it is hidden functions and so on, but they should be documented and doctested as any other.
Since there is only one class for SFT, I understand why everything is computed in the init. Because, we want to make sure once the init is done, that every objects behave the same what ever input was given. If I had to code such a class now, I would create four classes : class SFT(SageObject):
def __classcall__(self, data):
if data is a digraph:
return SFT_from_digraph(data)
elif data is a matrix:
return SFT_from_matrix(data)
if data is forbidden words:
return SFT_from_forbidden_words(data)
def matrix(self):
raise NotImplementedError("this is a specific method and must be coded in the child class")
def some_general_method(self):
pass
class SFT_from_digraph(SFT):
def __init__(self, data):
self._graph = data
def matrix(self):
M = ... # compute the matrix from the graph
return M
class SFT_from_matrix(SFT):
def __init__(self, data):
self._matrix = datta
def matrix(self):
return self._matrix
class SFT_from_forbidden_words(SFT):
def __init__(self, data):
self._forbidden = data
def matrix(self)
M = ... #compute the matrix from forbidden words
return M The advantage is that the code is closer to the reality (more clear, easier to maintain) and also more efficient (the matrix, for above example, is computed only if the user needs it). This ticket is open since too long time. I feel bad for asking such modifications so late... Should we just make it get into Sage and make future improvements then? I am sure the code is usefull as it is now so... So Michael, what do you think? Are you still motivated to work on it now? Sébastien |
comment:43
instructions for the bot: Apply trac_12996_SFT_final_version-MHS.patch trac_12996_SFT_addressed_final_comments-MHS.patch |
comment:44
better instructions: Apply trac_12996_SFT_final_version-MHS.patch trac_12996_SFT_addressed_final_comments-MHS.patch trac_12996_SFT_ouput_shortened-MHS.patch trac12996_SFT_output_modified_methods_renamed-MHS.patch trac_12996_SFT_solved_warnings-MHS.patch |
comment:46
this does not apply and needs to be rebased |
Branch: public/12996 |
Commit: |
comment:50
Hello, I am with Pierre Guillon in Marseille and we would like to put that patch in. I created a public branch for that and we will start from there. Vincent New commits:
|
comment:53
+Missing doctests dynamics/symbolic/finite_type_shift.py 35 / 42 = 83% |
Hi, as discussed with some people from the SAGE combinat group I (together with two students of mine) developed a class for subshifts of finite type which I would like to get feedback on and which could (hopefully should) be included into SAGE eventually.
The code already includes the basic features for playing around with those symbolic dynamical systems, but of course it will be extended over time. Just thought it would be nice to get some feedback on this first version right now, especially as the code is already long.
Apply:
CC: @sagetrac-tmonteil @videlec @sagetrac-tjolivet @seblabbe
Component: combinatorics
Keywords: symbolic dynamics
Author: Michael Schraudner
Branch/Commit: public/12996 @
5b28e76
Issue created by migration from https://trac.sagemath.org/ticket/12996
The text was updated successfully, but these errors were encountered: