Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://github.com/uberparagon/mgn
22 June 2021, 16:13:34 UTC
  • Code
  • Branches (5)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/master
    • refs/tags/1.1.2
    • refs/tags/v1.0.4
    • refs/tags/v1.0.5
    • refs/tags/v1.0.9
    No releases to show
  • 97085ea
  • /
  • topintersections
  • /
  • testvsMgnLb.py
Raw File Download
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
origin badgecontent badge Iframe embedding
swh:1:cnt:1b3ad81636c35aba8b153b2e5f9697859c189c02
origin badgedirectory badge Iframe embedding
swh:1:dir:370d394cc10295b17330f0bd86b2e47ea9df92ec
origin badgerevision badge
swh:1:rev:87eacb93177c9d41edb525bb71ae03ae45f18d14
origin badgesnapshot badge
swh:1:snp:6e9d4128140ea9fc091a9d1ff362de9d8be50de2
Citations

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Tip revision: 87eacb93177c9d41edb525bb71ae03ae45f18d14 authored by Drew Johnson on 20 March 2020, 16:48:33 UTC
added a ps and ps_ member to strataalgebra
Tip revision: 87eacb9
testvsMgnLb.py
"""
Uses unittest and compares this intersection code to Carel Faber's MgnLb.txt maple program.

To use, you'll need to  edit this file so that fabers_dir is the correct value.

Then, there are two choices:

1)  Edit the gn_pairs_to_check attribute to include the pairs you want to check.  Then, run
$ sage testvsMgnLb.py
and it will check them all.

2) Create a file in the format:

g, n, [list of classes by Faber's index]

e.g.:

1,3, [1,2,3]
0,4, [1]

and then do
$ sage testvsMgnLb.py testlist
(where testlist is the filename) and this will just check the things in your list.  This will make a quick check that you can run often.
"""
fabers_dir = "/home/drew/Dropbox/fabers maple code/Send10/"
gn_pairs_tocheck = ( (1,1), (0,4), (0,5), (0,6), (1,2), (1,3), (1,4), (2,0), (2,1), (2,2), (3,0))#( (5,0), (6,0), (7,0) )
    #(4,0)
    #( (1,1), (0,4), (0,5), (0,6), (1,2), (1,3), (1,4), (2,0), (2,1), (2,2), (3,0))



import  unittest
from sage.all import *
from intersection_ui import intnum
from TautRing3 import Mgn
from get_all_combis import get_all_valid_tuples

class TestVsMaple(unittest.TestCase):
    
    def check(self, g, n, c, verbose = True):
        #M = Mgn(g,n)
        #print M
        #C = Combinations( [M.fabers_classes_indexes()] * M.dimension, M.dimension )
        #print C
        #for c in Combinations( M.fabers_classes_indexes() * M.dimension, M.dimension ):
            #c = c[0] #????
        if verbose:
            print "Checking on M_{0}, {1}, classes {2}...".format(g,n, c)
        myans = intnum(g,n,c, confirm = False)
        #print "mgn({0}, {1})".format(g, c)
        mapleans = maple("mgn({0}, {1}, {2})".format(g, n, c))
        if verbose:
            print "values {3}, {4}".format(g,n, c, myans, mapleans)
        self.assertEqual(myans, mapleans, "FAILED:  for genus {0}, {1} marked points with classes {2}, my anwers: {3},  maple answer: {4}".format(g,n, c,myans,mapleans) )    
            
    
    
    
    
    def start_Maple(self):
        maple('currentdir("{0}")'.format(fabers_dir))
        maple.eval('read "MgnLb.txt"')
        print "Loaded MgnLb."
        
    def test_from_file(self, filename):  
        self.start_Maple()      
        with open(filename) as f:
            for line in f:
                g,n,c = eval(line)
                self.check(g,n,c)            

    def test_all(self):
        self.start_Maple()
        for g,n in gn_pairs_tocheck:
            print "Checking {0}, {1}...".format(g,n)
            M = Mgn(g,n) 
            for c in get_all_valid_tuples(M.degree_index_dict(), M.dimension):
                self.check(g,n,c)
        #save_data("genus4567test")

if __name__ == '__main__':
    #global filename
    import sys
    #tester = TestVsMaple()
    if len(sys.argv) > 1:
        #TestVsMaple.filename = sys.argv[1]
        tester = TestVsMaple("test_from_file")
        tester.test_from_file(sys.argv[1])
    else:
        tester = TestVsMaple("test_all")
        tester.test_all()
            

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Contact— JavaScript license information— Web API

back to top