def __init__(self, X, S, category=None, check=True): r""" EXAMPLES: The bug reported at trac #1785 is fixed:: sage: K.<a> = NumberField(x^2 + x - (3^3-3)) sage: E = EllipticCurve('37a') sage: X = E(K) sage: X Abelian group of points on Elliptic Curve defined by y^2 + y = x^3 + (-1)*x over Number Field in a with defining polynomial x^2 + x - 24 sage: P = X([3,a]) sage: P (3 : a : 1) sage: P in E False sage: P in E.base_extend(K) True """ R = X.base_ring() if R != S: X = X.base_extend(S) Y = spec.Spec(S, R) HomsetWithBase.__init__(self, Y, X, category=category, check=check, base=ZZ)
def hom(self, x, Y=None): r""" Return the scheme morphism from self to Y defined by x. If Y is not given, try to determine from context. EXAMPLES: We construct the inclusion from `\mathrm{Spec}(\QQ)` into `\mathrm{Spec}(\ZZ)` induced by the inclusion from `\ZZ` into `\QQ`. :: sage: X = Spec(QQ) sage: X.hom(ZZ.hom(QQ)) Affine Scheme morphism: From: Spectrum of Rational Field To: Spectrum of Integer Ring Defn: Ring Coercion morphism: From: Integer Ring To: Rational Field """ if is_Scheme(x): return self.Hom(x).natural_map() if Y is None: if is_RingHomomorphism(x): import spec Y = spec.Spec(x.domain()) return Scheme.hom(self, x, Y)
def base_scheme(self): """ Return the base scheme of the scheme self. EXAMPLES:: sage: A = AffineSpace(4, QQ) sage: A.base_scheme() Spectrum of Rational Field :: sage: X = Spec(QQ) sage: X.base_scheme() Spectrum of Integer Ring """ try: return self._base_scheme except AttributeError: if hasattr(self, '_base_morphism'): self._base_scheme = self._base_morphism.codomain() elif hasattr(self, '_base_ring'): import spec self._base_scheme = spec.Spec(self._base_ring) else: import spec self._base_scheme = spec.SpecZ return self._base_scheme
def hom(self, x, Y=None): r""" Return the scheme morphism from ``self`` to ``Y`` defined by ``x``. INPUT: - ``x`` -- anything hat determines a scheme morphism. If ``x`` is a scheme, try to determine a natural map to ``x``. - ``Y`` -- the codomain scheme (optional). If ``Y`` is not given, try to determine ``Y`` from context. - ``check`` -- boolean (optional, default=``True``). Whether to check the defining data for consistency. OUTPUT: The scheme morphism from ``self`` to ``Y`` defined by ``x``. EXAMPLES: We construct the inclusion from `\mathrm{Spec}(\QQ)` into `\mathrm{Spec}(\ZZ)` induced by the inclusion from `\ZZ` into `\QQ`:: sage: X = Spec(QQ) sage: X.hom(ZZ.hom(QQ)) Affine Scheme morphism: From: Spectrum of Rational Field To: Spectrum of Integer Ring Defn: Ring Coercion morphism: From: Integer Ring To: Rational Field TESTS: We can construct a morphism to an affine curve (trac #7956):: sage: S.<p,q> = QQ[] sage: A1.<r> = AffineSpace(QQ,1) sage: A1_emb = Curve(p-2) sage: A1.hom([2,r],A1_emb) Scheme morphism: From: Affine Space of dimension 1 over Rational Field To: Affine Curve over Rational Field defined by p - 2 Defn: Defined on coordinates by sending (r) to (2, r) """ if is_Scheme(x): return self.Hom(x).natural_map() if Y is None: if is_RingHomomorphism(x): import spec Y = spec.Spec(x.domain()) return Scheme.hom(self, x, Y)
def make_specs(self): xs = [i * 10 for i in range(60)] ys = xs specs = pygame.sprite.Group() for i in xs: for j in ys: spec = b.Spec(i, j) specs.add(spec) for spec in specs: spec.neighbours = spec.find_neighbours(specs) specs.draw(self.screen) return specs
def hom(self, x, Y=None): r""" Return the scheme morphism from ``self`` to ``Y`` defined by ``x``. INPUT: - ``x`` -- anything hat determines a scheme morphism. If ``x`` is a scheme, try to determine a natural map to ``x``. - ``Y`` -- the codomain scheme (optional). If ``Y`` is not given, try to determine ``Y`` from context. - ``check`` -- boolean (optional, default=``True``). Whether to check the defining data for consistency. OUTPUT: The scheme morphism from ``self`` to ``Y`` defined by ``x``. EXAMPLES: We construct the inclusion from `\mathrm{Spec}(\QQ)` into `\mathrm{Spec}(\ZZ)` induced by the inclusion from `\ZZ` into `\QQ`:: sage: X = Spec(QQ) sage: X.hom(ZZ.hom(QQ)) Affine Scheme morphism: From: Spectrum of Rational Field To: Spectrum of Integer Ring Defn: Ring Coercion morphism: From: Integer Ring To: Rational Field """ if is_Scheme(x): return self.Hom(x).natural_map() if Y is None: if is_RingHomomorphism(x): import spec Y = spec.Spec(x.domain()) return Scheme.hom(self, x, Y)
def base_morphism(self): """ Return the structure morphism from the scheme self to its base scheme. EXAMPLES:: sage: A = AffineSpace(4, QQ) sage: A.base_morphism() Scheme morphism: From: Affine Space of dimension 4 over Rational Field To: Spectrum of Rational Field Defn: Structure map :: sage: X = Spec(QQ) sage: X.base_morphism() Scheme morphism: From: Spectrum of Rational Field To: Spectrum of Integer Ring Defn: Structure map """ try: return self._base_morphism except AttributeError: from sage.categories.schemes import Schemes SCH = Schemes() if hasattr(self, '_base_scheme'): self._base_morphism = self.Hom(self._base_scheme, category=SCH).natural_map() elif hasattr(self, '_base_ring'): self._base_morphism = self.Hom(spec.Spec(self._base_ring), category=SCH).natural_map() else: self._base_morphism = self.Hom(spec.SpecZ, category=SCH).natural_map() return self._base_morphism
# Copy the damonized attribute into config setattr(config, 'daemonized', daemonized) setattr(config, 'log_file', bundle_path + '/test.log') setattr(config, 'services_bundle_path', bundle_path) # Create a core object for the plug-in bundle core = Framework.core.FrameworkCore(bundle_path, FRAMEWORK_DIR, config) # Try to load the plug-in code if not core.load_code(): sys.stderr.write('Error loading bundle code.\n') sys.exit(2) if core.init_code: core.sandbox.execute(core.init_code) sys.path.insert(0, core.code_path) import plex_nose import spec import sys sys.argv.insert(1, '-vv') sys.argv.insert(1, '-s') sys.argv.insert(1, '--with-spec') sys.argv.insert(1, '--spec-color') plex_nose.core = core plex_nose.nose.run(addplugins = [ spec.Spec() ]) os._exit(0)
def __init__(self, X, S): R = X.base_ring() if R != S: X = X.base_extend(S) SchemeHomset_generic.__init__(self, spec.Spec(S, R), X)
import paths import spec import experiment import expenv import version # get location of this stuff and add the paths, so no install is necessary psg_file = os.path.realpath(os.path.expanduser(__file__)) psg_prefix = os.path.dirname(os.path.dirname(psg_file)) # print(psg_prefix) spack_src_path = os.path.join(psg_prefix, "src") sys.path.insert(0, spack_src_path) # load all the stuff grids = spec.Spec('grid', paths.gridsfile) times = spec.Spec('time', paths.timesfile) icedyns = spec.Spec('icedynamic', paths.icedynfile) oceans = spec.Spec('ocean', paths.oceansfile) climates = spec.Spec('climate', paths.climatesfile) exps = spec.Spec('exp', paths.expsfile) def listCmd(args): if args.type == 'exps': exps.print_overview() # print(exps) def rsync_command(args): import subprocess
import time import spec import util if __name__ == "__main__": thespec = spec.Spec() theutil = util.Util() theutil.http_post("/tunnel/create", thespec.spec()) time.sleep(1)