Skip to content

Commit

Permalink
relative imports everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
shimwell committed Apr 22, 2024
1 parent 521b82a commit 583916f
Show file tree
Hide file tree
Showing 28 changed files with 115 additions and 160 deletions.
9 changes: 4 additions & 5 deletions src/GEOReverse/Modules/MCNPinput.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import math
import os
import sys
import re
import FreeCAD
from GEOReverse.Modules.Parser import parser as mp
from GEOReverse.Modules.remh import cell_card_string, remove_hash
from GEOReverse.Modules.Objects import *
import math
import numpy as np
from numpy import linalg as LA
from .Parser import parser as mp
from .remh import cell_card_string, remove_hash
from .Objects import *

class MCNPinput:
def __init__(self,name):
Expand Down
11 changes: 5 additions & 6 deletions src/GEOReverse/Modules/Objects.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from GEOReverse.Modules.buildSolidCell import BuildSolid
import FreeCAD, Part
import numpy as np
import math
from GEOReverse.Modules.remh import cline
from GEOReverse.Modules.Utils.booleanFunction import outterTerms,BoolSequence
from GEOReverse.Modules.Utils.BooleanSolids import buildCTableFromSolids
import numpy as np
import FreeCAD, Part
from .buildSolidCell import BuildSolid
from .remh import cline
from .Utils.booleanFunction import outterTerms,BoolSequence

class CADCell:
def __init__(self,stringCell=None):
Expand Down
2 changes: 1 addition & 1 deletion src/GEOReverse/Modules/Parser/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import re
import warnings
import os
from GEOReverse.Modules.Parser.PartialFormatter import PartialFormatter
from .PartialFormatter import PartialFormatter

version = '3.6'

Expand Down
5 changes: 2 additions & 3 deletions src/GEOReverse/Modules/Utils/BooleanSolids.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
# Conversion to MCNP v0.0
# Only one solid and planar surfaces
#
import math
import FreeCAD
import BOPTools.SplitAPI
import math
import re
from GEOReverse.Modules.Utils.booleanFunction import BoolSequence
from .booleanFunction import BoolSequence

BoolVals = (None,True,False)

Expand Down
2 changes: 1 addition & 1 deletion src/GEOReverse/Modules/XMLParser.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from GEOReverse.Modules.remh import cline
from .remh import cline

class cellCARD:

Expand Down
6 changes: 2 additions & 4 deletions src/GEOReverse/Modules/XMLinput.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import os
import sys
import re
import FreeCAD
from GEOReverse.Modules.remh import cell_card_string, remove_hash
from GEOReverse.Modules.Objects import *
from GEOReverse.Modules.XMLParser import get_cards
from .Objects import *
from .XMLParser import get_cards
import math
import numpy as np
from numpy import linalg as LA
Expand Down
6 changes: 2 additions & 4 deletions src/GEOReverse/Modules/buildCAD.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import FreeCAD, Part
import BOPTools.SplitAPI
from GEOReverse.Modules.buildSolidCell import FuseSolid
from GEOReverse.Modules.Utils.BooleanSolids import buildCTableFromSolids
from GEOReverse.Modules.Utils.booleanFunction import BoolSequence
from .buildSolidCell import FuseSolid
from .Utils.booleanFunction import BoolSequence



Expand Down
14 changes: 4 additions & 10 deletions src/GEOReverse/Modules/buildSolidCell.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import FreeCAD, Part
import BOPTools.SplitAPI
from BOPTools import GeneralFuseResult as GFR
from GEOReverse.Modules.Utils.booleanFunction import BoolSequence
from GEOReverse.Modules.splitFunction import SplitSolid,splitBase,joinBase
from GEOReverse.Modules.Utils.BooleanSolids import buildCTableFromSolids
from GEOReverse.Modules.options import Options

import math

import Part
from .Utils.booleanFunction import BoolSequence
from .splitFunction import SplitSolid,splitBase,joinBase
from .options import Options

def getPart(slist):
sol = []
Expand Down
2 changes: 1 addition & 1 deletion src/GEOReverse/Modules/processInp.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import configparser
from GEOReverse.Modules.options import Options
from .options import Options


def setOptions(optionFile):
Expand Down
1 change: 0 additions & 1 deletion src/GEOReverse/Modules/remh.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import sys
import re
import math

Expand Down
4 changes: 1 addition & 3 deletions src/GEOReverse/Modules/splitFunction.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import math
import FreeCAD,Part
import BOPTools.SplitAPI
from GEOReverse.Modules.Utils.booleanFunction import outterTerms
import math


class splitBase:
def __init__(self,base,knownSurf={}):
Expand Down
16 changes: 7 additions & 9 deletions src/GEOReverse/reverse.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import sys
import FreeCAD, Part, Import

from GEOReverse.Modules.MCNPinput import MCNPinput
from GEOReverse.Modules.XMLinput import XMLinput
from GEOReverse.Modules.buildCAD import buildCAD,makeTree
from GEOReverse.Modules.Objects import CADCell
from GEOReverse.Modules.processInp import setOptions
from GEOReverse.CodeVersion import *
import FreeCAD, Import
from .Modules.MCNPinput import MCNPinput
from .Modules.XMLinput import XMLinput
from .Modules.buildCAD import buildCAD,makeTree
from .Modules.Objects import CADCell
from .Modules.processInp import setOptions
from .CodeVersion import *


def reverse(optFile='configRevese.ini') :
Expand Down
3 changes: 1 addition & 2 deletions src/GEOUNED/LoadFile/LoadSTEP.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
import FreeCAD, Part
from FreeCAD import Import
from ..Utils import Functions as UF
from ..LoadFile import LoadFunctions as LF

from . import LoadFunctions as LF

# Paco mod
def extractMaterials(filename):
Expand Down
2 changes: 1 addition & 1 deletion src/GEOUNED/Utils/BasicFunctions_part1.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#
# Set of useful functions used in different parts of the code
#
import FreeCAD
import math
import FreeCAD

def isSameValue(v1,v2,tolerance=1e-6):
return abs(v1-v2) < tolerance
Expand Down
7 changes: 3 additions & 4 deletions src/GEOUNED/Utils/BasicFunctions_part2.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#
# Set of useful functions used in different parts of the code
#
from GEOUNED.Utils.BasicFunctions_part1 \
import isParallel, isOposite,isSameValue, isInTolerance, isInLine, isInPlane
from GEOUNED.Write.Functions import MCNPSurface
import FreeCAD
import math
import FreeCAD
from ..Utils.BasicFunctions_part1 import isParallel, isOposite,isSameValue, isInTolerance, isInLine, isInPlane
from ..Write.Functions import MCNPSurface


sameSurfFic = open('fuzzySurfaces','w')
Expand Down
9 changes: 4 additions & 5 deletions src/GEOUNED/Utils/BooleanSolids.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
# Conversion to MCNP v0.0
# Only one solid and planar surfaces
#
import FreeCAD
import math
import re
from GEOUNED.Utils.Functions import GEOUNED_Surface, splitBOP
from GEOUNED.Utils.booleanFunction import BoolSequence
from GEOUNED.Utils.Options.Classes import Options as opt
import FreeCAD
from ..Utils.Functions import GEOUNED_Surface, splitBOP
from ..Utils.booleanFunction import BoolSequence
from ..Utils.Options.Classes import Options as opt


BoolVals = (None,True,False)
Expand Down
15 changes: 7 additions & 8 deletions src/GEOUNED/Utils/Functions.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
#
# Set of useful functions used in different parts of the code
#
import BOPTools.SplitAPI
import GEOUNED.Utils.BasicFunctions_part2 as BF
from GEOUNED.Utils.BasicFunctions_part1 import isParallel,\
Plane3PtsParams, PlaneParams, CylinderParams, ConeParams, SphereParams, TorusParams
from GEOUNED.Utils.Options.Classes import Tolerances as tol
from GEOUNED.Utils.Options.Classes import Options
import copy
import FreeCAD, Part
import math
import numpy as np
import BOPTools.SplitAPI
import FreeCAD, Part
from . import BasicFunctions_part2 as BF
from ..Utils.BasicFunctions_part1 import isParallel,\
Plane3PtsParams, PlaneParams, CylinderParams, ConeParams, SphereParams, TorusParams
from ..Utils.Options.Classes import Tolerances as tol
from ..Utils.Options.Classes import Options


def getBox(comp):
Expand Down
8 changes: 4 additions & 4 deletions src/GEOUNED/Utils/Geometry_GU.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#
# definition of GEOUNED objects to release memory
#
import FreeCAD, Part
import math
from GEOUNED.Utils.BasicFunctions_part1 import isSameValue
from GEOUNED.Utils.BasicFunctions_part2 import isSameTorus
from GEOUNED.Utils.Options.Classes import Tolerances as tol
import Part
from .BasicFunctions_part1 import isSameValue
from .BasicFunctions_part2 import isSameTorus
from ..Utils.Options.Classes import Tolerances as tol

# SURFACES
class Surfaces_GU(object):
Expand Down
1 change: 1 addition & 0 deletions src/GEOUNED/Utils/booleanFunction.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import re

mostinner=re.compile(r"\([^\(^\)]*\)") # identify most inner parentheses
number =re.compile(r"(?P<value>[-+]?\d+)")
mix =re.compile(r"(?P<value>([-+]?\d+|\[0+\]))")
Expand Down
14 changes: 7 additions & 7 deletions src/GEOUNED/Void/Void.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from GEOUNED.Void.VoidBoxClass import VoidBox
from GEOUNED.Utils.BasicFunctions_part1 import isOposite
from GEOUNED.Utils.Functions import GEOUNED_Solid, GEOUNED_Surface
from GEOUNED.Utils.booleanFunction import BoolSequence
from GEOUNED.Utils.Options.Classes import Options as opt
import GEOUNED.LoadFile.LoadFunctions as LF
import GEOUNED.Void.voidFunctions as VF
import FreeCAD, Part
from .VoidBoxClass import VoidBox
from ..Utils.BasicFunctions_part1 import isOposite
from ..Utils.Functions import GEOUNED_Solid, GEOUNED_Surface
from ..Utils.booleanFunction import BoolSequence
from ..Utils.Options.Classes import Options as opt
from ..LoadFile import LoadFunctions as LF
from ..Void import voidFunctions as VF

def voidGeneration(MetaList,EnclosureList,Surfaces,UniverseBox,setting,init):
voidList = []
Expand Down
15 changes: 7 additions & 8 deletions src/GEOUNED/Void/VoidBoxClass.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
"""File with the VoidBox class"""
import FreeCAD
import Part
import GEOUNED.Decompose.Decom_one as Decom
import GEOUNED.Conversion.CellDefinition as Conv

from GEOUNED.Utils.Options.Classes import Options as opt
from GEOUNED.Utils.BasicFunctions_part1 import isOposite
from GEOUNED.Utils.Functions import GEOUNED_Solid, GEOUNED_Surface
from GEOUNED.Utils.booleanFunction import BoolSequence
from GEOUNED.Utils.BooleanSolids import buildCTableFromSolids, removeExtraSurfaces
from ..Decompose import Decom_one as Decom
from ..Conversion import CellDefinition as Conv
from ..Utils.Options.Classes import Options as opt
from ..Utils.BasicFunctions_part1 import isOposite
from ..Utils.Functions import GEOUNED_Solid, GEOUNED_Surface
from ..Utils.booleanFunction import BoolSequence
from ..Utils.BooleanSolids import buildCTableFromSolids, removeExtraSurfaces


class VoidBox ():
Expand Down
16 changes: 8 additions & 8 deletions src/GEOUNED/Write/Functions.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import GEOUNED.Utils.Qform as Qform
from GEOUNED.Utils.BasicFunctions_part1 import isParallel, isOposite
from GEOUNED.Utils.Options.Classes import MCNP_numeric_format as nf
from GEOUNED.Utils.Options.Classes import Tolerances as tol
from GEOUNED.Utils.Options.Classes import Options as opt
from GEOUNED.Write.StringFunctions import remove_redundant

import FreeCAD
import math
import re
import FreeCAD
from ..Utils import Qform as Qform
from ..Utils.BasicFunctions_part1 import isParallel, isOposite
from ..Utils.Options.Classes import MCNP_numeric_format as nf
from ..Utils.Options.Classes import Tolerances as tol
from ..Utils.Options.Classes import Options as opt
from .StringFunctions import remove_redundant


class CardLine :
def __init__(self,card,linesize=80,tabspace=6,fmt=''):
Expand Down
17 changes: 6 additions & 11 deletions src/GEOUNED/Write/MCNPFormat.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
##############################
# Module to write MCNP input #
##############################
import math
from datetime import datetime

from GEOUNED.Utils.Functions import Surfaces_dict
from GEOUNED.Utils.BasicFunctions_part1 import pointsToCoeffs,isOposite
from GEOUNED.Write.Functions import MCNPSurface, changeSurfSign, writeMCNPCellDef,CardLine
from GEOUNED.Utils.Options.Classes import MCNP_numeric_format as nf
from GEOUNED.Utils.Options.Classes import Tolerances as tol
from GEOUNED.Utils.Options.Classes import Options as opt
from GEOUNED.CodeVersion import *
import FreeCAD
import copy
import math
import re
from ..Utils.Functions import Surfaces_dict
from ..Utils.BasicFunctions_part1 import pointsToCoeffs,isOposite
from .Functions import MCNPSurface, changeSurfSign, writeMCNPCellDef,CardLine
from ..Utils.Options.Classes import Options as opt
from ..CodeVersion import *

class MCNP_input:
def __init__(self,Meta,Surfaces,setting) :
Expand Down
13 changes: 4 additions & 9 deletions src/GEOUNED/Write/OpenMCFormat.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
##############################
# Module to write MCNP input #
##############################
from datetime import datetime

from GEOUNED.Utils.Functions import Surfaces_dict
from GEOUNED.Write.Functions import OpenMCSurface, changeSurfSign, writeOpenMCregion,CardLine
from GEOUNED.Utils.Options.Classes import MCNP_numeric_format as nf
from GEOUNED.Utils.Options.Classes import Options as opt
from GEOUNED.CodeVersion import *
import FreeCAD
import copy
import math
import re
from ..Utils.Functions import Surfaces_dict
from .Functions import OpenMCSurface, changeSurfSign, writeOpenMCregion
from ..Utils.Options.Classes import Options as opt
from ..CodeVersion import *

class OpenMC_input:
def __init__(self,Meta,Surfaces,setting) :
Expand Down
18 changes: 7 additions & 11 deletions src/GEOUNED/Write/PHITSFormat.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,15 @@
# 5. Eliminated the only MCNP related parts
# 6. Added some comments to remind

import re
from datetime import datetime
from GEOUNED.Utils.Functions import Surfaces_dict
from GEOUNED.Utils.BasicFunctions_part1 import pointsToCoeffs,isOposite
from GEOUNED.Write.Functions import PHITSSurface, changeSurfSign, writePHITSCellDef,CardLine,CellString
from GEOUNED.Utils.Options.Classes import MCNP_numeric_format as nf
from GEOUNED.Utils.Options.Classes import Tolerances as tol
from GEOUNED.Utils.Options.Classes import Options as opt
from GEOUNED.CodeVersion import *
import FreeCAD
import copy
import math
import re
import os
from ..Utils.Functions import Surfaces_dict
from ..Utils.BasicFunctions_part1 import pointsToCoeffs,isOposite
from ..Write.Functions import PHITSSurface, changeSurfSign, writePHITSCellDef,CellString
from ..Utils.Options.Classes import Options as opt
from ..CodeVersion import *


class PHITS_input:
def __init__(self,Meta,Surfaces,setting) :
Expand Down
Loading

0 comments on commit 583916f

Please sign in to comment.