mfinzi/LieConv

View on GitHub

Showing 44 of 55 total issues

File datasets.py has 512 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import math
import torch
import torchvision.transforms as transforms
import torch.nn as nn
import torch.nn.functional as F
Severity: Major
Found in lie_conv/datasets.py - About 1 day to fix

    File lieGroups.py has 510 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import torch
    import numpy as np
    from lie_conv.utils import export, Named
    
    @export
    Severity: Major
    Found in lie_conv/lieGroups.py - About 1 day to fix

      File lieConv.py has 322 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      """ 
      Note to the Reader:
      
      In order to handle the generic spatial data we process features as a tuple: (coordinates,values,mask)
      with shapes (bs,n,d), (bs,n,c), (bs,n) where bs is batchsize, n is the maximum number of points in the minibatch,
      Severity: Minor
      Found in lie_conv/lieConv.py - About 3 hrs to fix

        Function __init__ has 17 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(self, chin, ds_frac=1, num_outputs=1, k=1536, nbhd=np.inf,
        Severity: Major
        Found in lie_conv/lieConv.py - About 2 hrs to fix

          Function __init__ has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              def __init__(self, data, included_species=None, num_pts=-1, normalize=True, shuffle=True, subtract_thermo=True):
          
                  self.data = data
          
                  if num_pts < 0:
          Severity: Minor
          Found in corm_data/dataset.py - About 2 hrs to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function process_xyz_md17 has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

          def process_xyz_md17(datafile):
              """
              Read xyz file and return a molecular dict with number of atoms, energy, forces, coordinates and atom-type for the MD-17 dataset.
          
              Parameters
          Severity: Minor
          Found in corm_data/prepare/process.py - About 2 hrs to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function makeTrainer has 15 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def makeTrainer(*, dataset=MnistRotDataset, network=ImgLieResnet, num_epochs=100,
          Severity: Major
          Found in examples/train_img.py - About 1 hr to fix

            Function prepare_dataset has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

            def prepare_dataset(datadir, dataset, subset=None, splits=None, cleanup=True, force_download=False):
                """
                Download and process dataset.
            
                Parameters
            Severity: Minor
            Found in corm_data/prepare/download.py - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function makeTrainer has 11 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def makeTrainer(*, task='homo', device='cuda', lr=3e-3, bs=75, num_epochs=500,network=MolecLieResNet, 
            Severity: Major
            Found in examples/equivariance_demo.py - About 1 hr to fix

              Function __init__ has 11 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def __init__(self,chin=1,total_ds=1/64,num_layers=6,group=T(2),fill=1/32,k=256,
              Severity: Major
              Found in lie_conv/lieConv.py - About 1 hr to fix

                Function __init__ has 11 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def __init__(self,d=2,sys_dim=2,bn=False,num_layers=4,group=T(2),k=384,knn=False,nbhd=100,mean=True,center=True,**kwargs):
                Severity: Major
                Found in lie_conv/dynamicsTrainer.py - About 1 hr to fix

                  Function __init__ has 10 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def __init__(self,d=2,sys_dim=2,bn=False,num_layers=4,group=T(2),k=384,knn=False,nbhd=100,mean=True,**kwargs):
                  Severity: Major
                  Found in lie_conv/dynamicsTrainer.py - About 1 hr to fix

                    Function __init__ has 9 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def __init__(self,chin,chout,mc_samples=32,xyz_dim=3,ds_frac=1,knn_channels=None,act='swish',bn=False,mean=False):
                    Severity: Major
                    Found in lie_conv/lieConv.py - About 1 hr to fix

                      Function gen_splits_gdb9 has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      def gen_splits_gdb9(gdb9dir, cleanup=True):
                          """
                          Generate GDB9 training/validation/test splits used.
                      
                          First, use the file 'uncharacterized.txt' in the GDB9 figshare to find a
                      Severity: Minor
                      Found in corm_data/prepare/qm9.py - About 1 hr to fix

                        Function __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def __init__(self, root_dir=default_root_dir, train=True, download=True, n_systems=100, regen=False,
                        Severity: Major
                        Found in lie_conv/datasets.py - About 1 hr to fix

                          Function forward has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def forward(self,inp,withquery=False):
                                  abq_pairs,vals,mask = inp
                                  dist = self.group.distance if self.group else lambda ab: norm(ab,dim=-1)
                                  if self.ds_frac!=1:
                                      if self.cache and self.cached_indices is None:
                          Severity: Minor
                          Found in lie_conv/lieConv.py - About 55 mins to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Function process_xyz_files has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def process_xyz_files(data, process_file_fn, file_ext=None, file_idx_list=None, stack=True):
                              """
                              Take a set of datafiles and apply a predefined data processing script to each
                              one. Data can be stored in a directory, tarfile, or zipfile. An optional
                              file extension can be added.
                          Severity: Minor
                          Found in corm_data/prepare/process.py - About 55 mins to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              def __init__(self, root_dir=default_root_dir, train=True, download=True, n_systems=100, space_dim=2, regen=False,
                          Severity: Major
                          Found in lie_conv/datasets.py - About 50 mins to fix

                            Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                def __init__(self,*args,group=T(3),ds_frac=1,fill=1/3,cache=False,knn=False,**kwargs):
                            Severity: Major
                            Found in lie_conv/lieConv.py - About 50 mins to fix

                              Function prepare_dataset has 6 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              def prepare_dataset(datadir, dataset, subset=None, splits=None, cleanup=True, force_download=False):
                              Severity: Minor
                              Found in corm_data/prepare/download.py - About 45 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language