repo stringlengths 2 99 | file stringlengths 13 225 | code stringlengths 0 18.3M | file_length int64 0 18.3M | avg_line_length float64 0 1.36M | max_line_length int64 0 4.26M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
Comp2Comp | Comp2Comp-master/comp2comp/io/io_utils.py | """
@author: louisblankemeier
"""
import os
import nibabel as nib
def find_dicom_files(input_path):
dicom_series = []
if not os.path.isdir(input_path):
dicom_series = [str(os.path.abspath(input_path))]
else:
for root, _, files in os.walk(input_path):
for file in files:
... | 1,883 | 28.904762 | 88 | py |
Comp2Comp | Comp2Comp-master/comp2comp/aortic_calcium/visualization.py | import os
import numpy as np
from comp2comp.inference_class_base import InferenceClass
class AorticCalciumVisualizer(InferenceClass):
def __init__(self):
super().__init__()
def __call__(self, inference_pipeline):
self.output_dir = inference_pipeline.output_dir
self.output_dir_image... | 3,395 | 34.747368 | 98 | py |
Comp2Comp | Comp2Comp-master/comp2comp/aortic_calcium/aortic_calcium.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 20 20:36:05 2023
@author: maltejensen
"""
import os
import time
from pathlib import Path
from typing import Union
import numpy as np
from scipy import ndimage
from totalsegmentator.libs import (
download_pretrained_weights,
nostdout,
se... | 14,459 | 35.515152 | 100 | py |
Comp2Comp | Comp2Comp-master/comp2comp/models/models.py | import enum
import os
from pathlib import Path
from typing import Dict, Sequence
import wget
from keras.models import load_model
class Models(enum.Enum):
ABCT_V_0_0_1 = (
1,
"abCT_v0.0.1",
{"muscle": 0, "imat": 1, "vat": 2, "sat": 3},
False,
("soft", "bone", "custom"),
... | 3,821 | 24.651007 | 110 | py |
Comp2Comp | Comp2Comp-master/comp2comp/contrast_phase/contrast_inf.py | import argparse
import os
import pickle
import sys
import nibabel as nib
import numpy as np
import scipy
import SimpleITK as sitk
from scipy import ndimage as ndi
def loadNiiToArray(path):
NiImg = nib.load(path)
array = np.array(NiImg.dataobj)
return array
def loadNiiWithSitk(path):
reader = sitk.I... | 13,957 | 30.436937 | 121 | py |
Comp2Comp | Comp2Comp-master/comp2comp/contrast_phase/contrast_phase.py | import os
from pathlib import Path
from time import time
from typing import Union
from totalsegmentator.libs import (
download_pretrained_weights,
nostdout,
setup_nnunet,
)
from comp2comp.contrast_phase.contrast_inf import predict_phase
from comp2comp.inference_class_base import InferenceClass
class Con... | 3,465 | 28.87931 | 90 | py |
Comp2Comp | Comp2Comp-master/comp2comp/metrics/metrics.py | from abc import ABC, abstractmethod
from typing import Callable, Sequence, Union
import numpy as np
def flatten_non_category_dims(
xs: Union[np.ndarray, Sequence[np.ndarray]], category_dim: int = None
):
"""Flattens all non-category dimensions into a single dimension.
Args:
xs (ndarrays): Sequen... | 4,820 | 29.707006 | 84 | py |
Comp2Comp | Comp2Comp-master/comp2comp/muscle_adipose_tissue/data.py | import math
from typing import List, Sequence
import keras.utils as k_utils
import numpy as np
import pydicom
from keras.utils.data_utils import OrderedEnqueuer
from tqdm import tqdm
def parse_windows(windows):
"""Parse windows provided by the user.
These windows can either be strings corresponding to popul... | 5,857 | 26.763033 | 99 | py |
Comp2Comp | Comp2Comp-master/comp2comp/muscle_adipose_tissue/muscle_adipose_tissue.py | import os
from time import perf_counter
from typing import List
import cv2
import h5py
import numpy as np
import pandas as pd
from keras import backend as K
from tqdm import tqdm
from comp2comp.inference_class_base import InferenceClass
from comp2comp.metrics.metrics import CrossSectionalArea, HounsfieldUnits
from co... | 11,794 | 34.42042 | 99 | py |
Comp2Comp | Comp2Comp-master/comp2comp/muscle_adipose_tissue/muscle_adipose_tissue_visualization.py | """
@author: louisblankemeier
"""
import os
from pathlib import Path
import numpy as np
from comp2comp.inference_class_base import InferenceClass
from comp2comp.visualization.detectron_visualizer import Visualizer
class MuscleAdiposeTissueVisualizer(InferenceClass):
def __init__(self):
super().__init__... | 6,119 | 33.772727 | 99 | py |
Comp2Comp | Comp2Comp-master/comp2comp/visualization/dicom.py | import os
from pathlib import Path
import numpy as np
import pydicom
from PIL import Image
from pydicom.dataset import Dataset, FileMetaDataset
from pydicom.uid import ExplicitVRLittleEndian
def to_dicom(input, output_path, plane="axial"):
"""Converts a png image to a dicom image. Written with assistance from C... | 2,389 | 33.142857 | 98 | py |
Comp2Comp | Comp2Comp-master/comp2comp/visualization/linear_planar_reformation.py | """
@author: louisblankemeier
"""
import numpy as np
def linear_planar_reformation(
medical_volume: np.ndarray, segmentation: np.ndarray, centroids, dimension="axial"
):
if dimension == "sagittal" or dimension == "coronal":
centroids = sorted(centroids, key=lambda x: x[2])
elif dimension == "axia... | 3,316 | 37.126437 | 100 | py |
Comp2Comp | Comp2Comp-master/comp2comp/visualization/detectron_visualizer.py | # Copyright (c) Facebook, Inc. and its affiliates.
import colorsys
import logging
import math
import os
from enum import Enum, unique
from pathlib import Path
import cv2
import matplotlib as mpl
import matplotlib.colors as mplc
import matplotlib.figure as mplfigure
import numpy as np
import pycocotools.mask as mask_ut... | 48,577 | 38.526444 | 100 | py |
Comp2Comp | Comp2Comp-master/comp2comp/spine/spine_visualization.py | """
@author: louisblankemeier
"""
import os
from pathlib import Path
from typing import Union
import numpy as np
from comp2comp.visualization.detectron_visualizer import Visualizer
def spine_binary_segmentation_overlay(
img_in: Union[str, Path],
mask: Union[str, Path],
base_path: Union[str, Path],
... | 4,315 | 26.666667 | 79 | py |
Comp2Comp | Comp2Comp-master/comp2comp/spine/spine.py | """
@author: louisblankemeier
"""
import math
import os
import shutil
import zipfile
from pathlib import Path
from time import time
from typing import Union
import nibabel as nib
import numpy as np
import pandas as pd
import wget
from PIL import Image
from totalsegmentator.libs import (
download_pretrained_weight... | 14,371 | 34.574257 | 99 | py |
Comp2Comp | Comp2Comp-master/comp2comp/spine/spine_utils.py | """
@author: louisblankemeier
"""
import logging
import math
from glob import glob
from typing import Dict, List
import cv2
import numpy as np
from pydicom.filereader import dcmread
from scipy.ndimage import zoom
from comp2comp.spine import spine_visualization
def find_spine_dicoms(centroids: Dict, path: str, leve... | 24,734 | 33.887165 | 107 | py |
Comp2Comp | Comp2Comp-master/comp2comp/utils/colormap.py | # Copyright (c) Facebook, Inc. and its affiliates.
"""
An awesome colormap for really neat visualizations.
Copied from Detectron, and removed gray colors.
"""
import random
import numpy as np
__all__ = ["colormap", "random_color", "random_colors"]
# fmt: off
# RGB:
_COLORS = np.array(
[
0.000, 0.447, 0... | 4,094 | 25.082803 | 87 | py |
Comp2Comp | Comp2Comp-master/comp2comp/utils/orientation.py | import nibabel as nib
from comp2comp.inference_class_base import InferenceClass
class ToCanonical(InferenceClass):
"""Convert spine segmentation to canonical orientation."""
def __init__(self):
super().__init__()
def __call__(self, inference_pipeline):
"""
First dim goes from L ... | 842 | 32.72 | 94 | py |
Comp2Comp | Comp2Comp-master/comp2comp/utils/logger.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import functools
import logging
import os
import sys
import time
from collections import Counter
from termcolor import colored
logging.captureWarnings(True)
class _ColorfulFormatter(logging.Formatter):
def __init__(self, *args, **kwargs):
... | 6,831 | 31.533333 | 101 | py |
Comp2Comp | Comp2Comp-master/comp2comp/utils/run.py | import logging
import os
import re
from typing import Sequence, Union
logger = logging.getLogger(__name__)
def format_output_path(
file_path,
save_dir: str = None,
base_dirs: Sequence[str] = None,
file_name: Sequence[str] = None,
):
"""Format output path for a given file.
Args:
file_... | 3,692 | 28.544 | 93 | py |
Comp2Comp | Comp2Comp-master/comp2comp/utils/__init__.py | 0 | 0 | 0 | py | |
Comp2Comp | Comp2Comp-master/comp2comp/utils/dl_utils.py | import subprocess
from keras import Model
# from keras.utils import multi_gpu_model
# from tensorflow.python.keras.utils.multi_gpu_utils import multi_gpu_model
def get_available_gpus(num_gpus: int = None):
"""Get gpu ids for gpus that are >95% free.
Tensorflow does not support checking free memory on gpus.... | 2,610 | 34.767123 | 99 | py |
Comp2Comp | Comp2Comp-master/comp2comp/utils/process.py | """
@author: louisblankemeier
"""
import os
import shutil
import sys
import traceback
from datetime import datetime
from pathlib import Path
from time import time
from comp2comp.io.io_utils import get_dicom_or_nifti_paths_and_num
def process_2d(args, pipeline_builder):
output_dir = Path(
os.path.join(
... | 3,239 | 29 | 95 | py |
Comp2Comp | Comp2Comp-master/comp2comp/utils/env.py | import importlib
import importlib.util
import os
import sys
__all__ = []
# from https://stackoverflow.com/questions/67631/how-to-import-a-module-given-the-full-path # noqa
def _import_file(module_name, file_path, make_importable=False):
spec = importlib.util.spec_from_file_location(module_name, file_path)
m... | 2,539 | 30.358025 | 99 | py |
Comp2Comp | Comp2Comp-master/comp2comp/hip/hip_utils.py | """
@author: louisblankemeier
"""
import math
import os
import shutil
import cv2
import nibabel as nib
import numpy as np
import scipy.ndimage as ndi
from scipy.ndimage import zoom
from skimage.morphology import ball, binary_erosion
from comp2comp.hip.hip_visualization import method_visualizer
def compute_rois(med... | 12,093 | 36.212308 | 102 | py |
Comp2Comp | Comp2Comp-master/comp2comp/hip/hip.py | """
@author: louisblankemeier
"""
import os
from pathlib import Path
from time import time
from typing import Union
import pandas as pd
from totalsegmentator.libs import (
download_pretrained_weights,
nostdout,
setup_nnunet,
)
from comp2comp.hip import hip_utils
from comp2comp.hip.hip_visualization impor... | 9,838 | 33.522807 | 99 | py |
Comp2Comp | Comp2Comp-master/comp2comp/hip/hip_visualization.py | """
@author: louisblankemeier
"""
import os
import numpy as np
from scipy.ndimage import zoom
from comp2comp.visualization.detectron_visualizer import Visualizer
from comp2comp.visualization.linear_planar_reformation import (
linear_planar_reformation,
)
def method_visualizer(
sagittal_image,
axial_ima... | 5,065 | 31.063291 | 100 | py |
Comp2Comp | Comp2Comp-master/comp2comp/liver_spleen_pancreas/visualization_utils.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import matplotlib.pyplot as plt
import numpy as np
import scipy
from matplotlib.colors import ListedColormap
from PIL import Image
def extract_axial_mid_slice(ct, mask, crop=True):
slice_idx = np.argmax(mask.sum(axis=(0, 1)))
ct_slice_z = np.transpo... | 9,235 | 28.227848 | 100 | py |
Comp2Comp | Comp2Comp-master/comp2comp/liver_spleen_pancreas/visualization.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import numpy as np
from comp2comp.inference_class_base import InferenceClass
from comp2comp.liver_spleen_pancreas.visualization_utils import (
generate_liver_spleen_pancreas_report,
generate_slice_images,
)
class LiverSpleenPancreasVisualizer(Inferen... | 3,687 | 31.069565 | 98 | py |
Comp2Comp | Comp2Comp-master/comp2comp/liver_spleen_pancreas/liver_spleen_pancreas.py | import os
from pathlib import Path
from time import time
from typing import Union
from totalsegmentator.libs import (
download_pretrained_weights,
nostdout,
setup_nnunet,
)
from comp2comp.inference_class_base import InferenceClass
class LiverSpleenPancreasSegmentation(InferenceClass):
"""Organ segme... | 2,723 | 27.673684 | 96 | py |
Comp2Comp | Comp2Comp-master/docs/source/conf.py | # Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master... | 1,598 | 26.568966 | 85 | py |
g2p | g2p-master/setup.py | #from distutils.core import setup
from setuptools import setup
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name = 'g2p_... | 1,058 | 30.147059 | 104 | py |
g2p | g2p-master/g2p_en/expand.py | # -*- coding: utf-8 -*-
#/usr/bin/python2
'''
Borrowed
from https://github.com/keithito/tacotron/blob/master/text/numbers.py
By kyubyong park. kbpark.linguist@gmail.com.
https://www.github.com/kyubyong/g2p
'''
from __future__ import print_function
import inflect
import re
_inflect = inflect.engine()
_comma_number_re... | 2,491 | 30.15 | 99 | py |
g2p | g2p-master/g2p_en/__init__.py | from .g2p import G2p
| 21 | 10 | 20 | py |
g2p | g2p-master/g2p_en/g2p.py | # -*- coding: utf-8 -*-
# /usr/bin/python
'''
By kyubyong park(kbpark.linguist@gmail.com) and Jongseok Kim(https://github.com/ozmig77)
https://www.github.com/kyubyong/g2p
'''
from nltk import pos_tag
from nltk.corpus import cmudict
import nltk
from nltk.tokenize import TweetTokenizer
word_tokenize = TweetTokenizer().to... | 7,595 | 37.953846 | 138 | py |
spark-jobserver | spark-jobserver-master/job-server-python/__init__.py | 0 | 0 | 0 | py | |
spark-jobserver | spark-jobserver-master/job-server-python/src/python/setup.py | from setuptools import setup, find_packages
import os
setup(
name="spark-jobserver-python",
version=os.getenv("SJS_VERSION", "NO_ENV"),
description=("The python modules required to "
"support PySpark jobs in Spark Job Server"),
url="https://github.com/spark-jobserver/spark-jobserver",
... | 456 | 31.642857 | 61 | py |
spark-jobserver | spark-jobserver-master/job-server-python/src/python/setup-examples.py | from setuptools import setup, find_packages
import os
setup(
name='sjs-python-examples',
version=os.getenv('SJS_VERSION', 'NO_ENV'),
description='Examples of jobs for Spark Job Server',
url='https://github.com/spark-jobserver/spark-jobserver',
license='Apache License 2.0',
... | 427 | 31.923077 | 65 | py |
spark-jobserver | spark-jobserver-master/job-server-python/src/python/sparkjobserver/subprocess.py | """
This module is a runnable program designed to be called from
a JVM process in order to execute a Python Spark-Job-Server job.
It should be executed using a single argument, which is the port
number of the Py4J gateway client which the JVM application should
start before calling this program as a subprocess.
The J... | 5,450 | 39.679104 | 78 | py |
spark-jobserver | spark-jobserver-master/job-server-python/src/python/sparkjobserver/api.py | """
This module defines the interfaces for Python based
Spark Job Server Jobs. Due to Python's typing, jobs
do not need to inherit from these classes but they must
implement the relevant methods described in SparkJob.
"""
class SparkJob:
"""
The primary interface for Python jobs in SparkJob server.
A job ... | 8,538 | 37.463964 | 79 | py |
spark-jobserver | spark-jobserver-master/job-server-python/src/python/sparkjobserver/__init__.py | 0 | 0 | 0 | py | |
spark-jobserver | spark-jobserver-master/job-server-python/src/python/test/apitests.py | import errno
import os
import unittest
from pyhocon import ConfigFactory
from pyspark import SparkConf, SparkContext
from pyspark.sql import SQLContext, HiveContext
from sparkjobserver.api import SparkJob, build_problems, ValidationProblem
from py4j.java_gateway import java_import
def silentremove(filename):
try:... | 5,202 | 33.230263 | 78 | py |
spark-jobserver | spark-jobserver-master/job-server-python/src/python/example_jobs/__init__.py | 0 | 0 | 0 | py | |
spark-jobserver | spark-jobserver-master/job-server-python/src/python/example_jobs/hive_support_job/__init__.py | from sparkjobserver.api import SparkJob, build_problems
class HiveSupportJob(SparkJob):
def validate(self, context, runtime, config):
return None
def run_job(self, context, runtime, data):
query = 'CREATE TABLE IF NOT EXISTS check_support ' \
'(key INT, value STRING) USING hiv... | 350 | 28.25 | 61 | py |
spark-jobserver | spark-jobserver-master/job-server-python/src/python/example_jobs/sql_two_jobs/__init__.py | from sparkjobserver.api import SparkJob, build_problems
from pyspark.sql import SQLContext
class Job1(SparkJob):
def validate(self, context, runtime, config):
problems = []
job_data = None
if not isinstance(context, SQLContext):
problems.append('Expected a SQL context')
... | 2,036 | 34.12069 | 67 | py |
spark-jobserver | spark-jobserver-master/job-server-python/src/python/example_jobs/custom_context_job/__init__.py | from sparkjobserver.api import SparkJob, build_problems
from pyspark import SparkContext
class CustomContext(SparkContext):
def __init__(self, gateway, customContext, sparkConf):
self.jcustomContext = customContext
SparkContext.__init__(
self, gateway=gateway, jsc=customContext, c... | 956 | 30.9 | 73 | py |
spark-jobserver | spark-jobserver-master/job-server-python/src/python/example_jobs/session_window/__init__.py | from sparkjobserver.api import SparkJob, build_problems
from pyspark.sql import SparkSession
class SessionWindowJob(SparkJob):
def validate(self, context, runtime, config):
problems = []
job_data = None
if not isinstance(context, SparkSession):
problems.append('Expected a Spar... | 1,176 | 34.666667 | 72 | py |
spark-jobserver | spark-jobserver-master/job-server-python/src/python/example_jobs/failing_job/__init__.py | from sparkjobserver.api import SparkJob, build_problems
class FailingRunJob(SparkJob):
def validate(self, context, runtime, config):
return "fine"
def run_job(self, context, runtime, data):
raise Exception("Deliberate failure")
class FailingValidateJob(SparkJob):
def validate(self, co... | 452 | 21.65 | 55 | py |
spark-jobserver | spark-jobserver-master/job-server-python/src/python/example_jobs/word_count/__init__.py | from sparkjobserver.api import SparkJob, build_problems
class WordCountSparkJob(SparkJob):
def validate(self, context, runtime, config):
if config.get('input.strings', None):
return config.get('input.strings')
else:
return build_problems(['config input.strings not found'])... | 1,279 | 29.47619 | 69 | py |
spark-jobserver | spark-jobserver-master/job-server-python/src/python/example_jobs/hive_window/__init__.py | from sparkjobserver.api import SparkJob, build_problems
from pyspark.sql import HiveContext
class HiveWindowJob(SparkJob):
def validate(self, context, runtime, config):
problems = []
job_data = None
if not isinstance(context, HiveContext):
problems.append('Expected a HiveConte... | 1,161 | 34.212121 | 72 | py |
spark-jobserver | spark-jobserver-master/job-server-python/src/python/example_jobs/sql_average/__init__.py | from sparkjobserver.api import SparkJob, build_problems
from pyspark.sql import SQLContext
class SQLAverageJob(SparkJob):
def validate(self, context, runtime, config):
problems = []
job_data = None
if not isinstance(context, SQLContext):
problems.append('Expected a SQL context... | 1,009 | 33.827586 | 68 | py |
igmspec | igmspec-master/setup.py | #!/usr/bin/env python
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function
#
# Standard imports
#
import glob, os
from distutils.extension import Extension
#
# setuptools' sdist command ignores MANIFEST.in
#
#from distutils.command.sdist import... | 2,817 | 31.022727 | 104 | py |
igmspec | igmspec-master/timing/time_indiv_spec.py | """ Test time to load spectra one by one
"""
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
import cProfile, pstats
from astropy.coordinates import SkyCoord
from igmspec.igmspec import IgmSpec
def time_coord_to_spec(survey='HD-LLS_DR1', ntrials=1000, seed=123):... | 1,241 | 23.352941 | 82 | py |
igmspec | igmspec-master/igmspec/defs.py | """ Module for key definitions in the IGMspec database
"""
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
import pdb
from collections import OrderedDict
from astropy import units as u
def z_priority():
""" List of redshift priorities for setting the DB reds... | 2,623 | 28.483146 | 82 | py |
igmspec | igmspec-master/igmspec/__init__.py | 0 | 0 | 0 | py | |
igmspec | igmspec-master/igmspec/chk_pairs.py | """ Module to check for pairs in igmspec
"""
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
import pdb
from specdb.specdb import IgmSpec
from astropy import units as u
from astropy.coordinates import match_coordinates_sky, SkyCoord
from astropy.table import Tabl... | 4,181 | 26.333333 | 106 | py |
igmspec | igmspec-master/igmspec/setup_package.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
def get_package_data():
return {'igmspec.tests': ['files/*']}
| 132 | 21.166667 | 63 | py |
igmspec | igmspec-master/igmspec/build_db.py | """ Module to build the hdf5 database file for IGMspec
"""
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
import os, warnings
import h5py
import json
import datetime
import pdb
from collections import OrderedDict
from specdb import defs
from specdb.build import ... | 15,398 | 32.045064 | 104 | py |
igmspec | igmspec-master/igmspec/scripts/__init__.py | 0 | 0 | 0 | py | |
igmspec | igmspec-master/igmspec/scripts/build_igmspec.py | #!/usr/bin/env python
"""
Run a build of the DB
"""
from __future__ import (print_function, absolute_import, division, unicode_literals)
import pdb
try: # Python 3
ustr = unicode
except NameError:
ustr = str
def parser(options=None):
import argparse
# Parse
parser = argparse.ArgumentParser(
... | 3,002 | 31.290323 | 109 | py |
igmspec | igmspec-master/igmspec/tests/test_ssa.py | # Module to run tests on scripts
# TEST_UNICODE_LITERALS
import pytest
import os
from specdb.specdb import IgmSpec
from specdb import ssa as spdb_ssa
#version = 'v01'
version = 'v02'
def data_path(filename):
data_dir = os.path.join(os.path.dirname(__file__), 'files')
return os.path.join(data_dir, filename)... | 1,083 | 24.209302 | 97 | py |
igmspec | igmspec-master/igmspec/tests/__init__.py | 0 | 0 | 0 | py | |
igmspec | igmspec-master/igmspec/tests/test_scripts.py | # Module to run tests on scripts
import matplotlib
matplotlib.use('agg') # For Travis
# TEST_UNICODE_LITERALS
import pytest
import os
#version = 'v01'
version = 'v02'
def data_path(filename):
data_dir = os.path.join(os.path.dirname(__file__), 'files')
return os.path.join(data_dir, filename)
| 309 | 14.5 | 63 | py |
igmspec | igmspec-master/igmspec/ingest/uves_dall.py | """ Module to ingest UVES data from Dall'Aglio
Dall'Aglio et al. 2008, A&A, 491, 465
"""
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
import pdb
import os, glob
import imp
import json
from astropy.coordinates import SkyCoord, match_coordinates_sky
from astrop... | 7,057 | 31.525346 | 104 | py |
igmspec | igmspec-master/igmspec/ingest/musodla.py | """ Module to ingest MUSoDLA survey
Jorgensen et al. 2013
"""
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
import pdb
import os, json, glob, imp
from astropy.coordinates import SkyCoord, match_coordinates_sky
from astropy.table import Table, Column
from astro... | 7,608 | 31.797414 | 97 | py |
igmspec | igmspec-master/igmspec/ingest/uves_squad.py | """ Module to ingest UVES SQUAD DR1 data
Murphy et al. 2018
"""
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
import pdb
import os, json, glob, imp
import datetime
from astropy.table import Table, Column
from astropy.coordinates import SkyCoord
from astropy im... | 6,181 | 29.756219 | 106 | py |
igmspec | igmspec-master/igmspec/ingest/myers.py | """ Module to ingest Myers' QSOs
"""
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
import os
import pdb
from astropy.table import Table
from astropy.io import fits
from astropy import units as u
from linetools import utils as ltu
from specdb.build import utils... | 13,950 | 34.589286 | 114 | py |
igmspec | igmspec-master/igmspec/ingest/boss_dr14.py | """ Module to ingest SDSS III (aka BOSS) data products
"""
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
import os, json
import pdb
import datetime
from pkg_resources import resource_filename
from astropy.table import Table, Column, vstack
from astropy.time im... | 11,371 | 31.772334 | 121 | py |
igmspec | igmspec-master/igmspec/ingest/hdlls.py | """ Module to ingest HD-LLS Survey data
Prochaska et al. 2015
"""
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
import pdb
import os, json, glob, imp
import datetime
from astropy.table import Table, Column
from astropy.coordinates import SkyCoord, match_coordi... | 11,684 | 34.195783 | 91 | py |
igmspec | igmspec-master/igmspec/ingest/sdss.py | """ Module to ingest SDSS II (aka SDSS) data products
"""
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
import os, json
import pdb
import datetime
from astropy.table import Table, Column
from astropy.time import Time
from astropy.coordinates import SkyCoord, m... | 9,499 | 33.050179 | 117 | py |
igmspec | igmspec-master/igmspec/ingest/esi_z6.py | """ Module to ingest GGG Survey data
Worseck et al. 2014
"""
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
import pdb
import os
import json
from astropy.table import Table, Column, vstack
from astropy.time import Time
from astropy.coordinates import SkyCoord
f... | 5,455 | 28.491892 | 115 | py |
igmspec | igmspec-master/igmspec/ingest/hst_qso.py | """ Module to ingest HD-LLS Survey data
Prochaska et al. 2015
"""
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
import pdb
import warnings
import os, json, glob, imp
import datetime
from astropy.table import Table, Column, vstack
from astropy.coordinates impor... | 10,146 | 33.869416 | 114 | py |
igmspec | igmspec-master/igmspec/ingest/hst_z2.py | """ Module to ingest HD-LLS Survey data
Prochaska et al. 2015
"""
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
import pdb
import warnings
import os, json
from astropy.table import Table, Column
from astropy.coordinates import SkyCoord, match_coordinates_sky
f... | 6,368 | 29.768116 | 122 | py |
igmspec | igmspec-master/igmspec/ingest/hdla100.py | """ Module to ingest HIRES DLA 100 Survey data
Neeleman et al. 2013
"""
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
import pdb
import os, json, glob, imp
import datetime
from astropy.table import Table, Column
from astropy import units as u
from astropy.time... | 6,680 | 30.663507 | 106 | py |
igmspec | igmspec-master/igmspec/ingest/utils.py | """ Module to for ingest utilities
"""
from __future__ import print_function, absolute_import, division, unicode_literals
| 124 | 19.833333 | 82 | py |
igmspec | igmspec-master/igmspec/ingest/kodiaq_two.py | """ Module to ingest KODIAQ DR2 Survey data
O'Meara et al. 2017
"""
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
import pdb
import os, json
import datetime
from astropy.table import Table, Column
from astropy.coordinates import SkyCoord, match_coordinates_sk... | 6,004 | 29.637755 | 87 | py |
igmspec | igmspec-master/igmspec/ingest/xq100.py | """ Module to ingest XQ-100 Survey data
Lopez et al. 2016
"""
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
import pdb
import os, glob
import imp
import json
from astropy.coordinates import SkyCoord, match_coordinates_sky
from astropy.table import Table, Colum... | 9,012 | 30.848057 | 103 | py |
igmspec | igmspec-master/igmspec/ingest/cos_dwarfs.py | """ Module to ingest COS-Dwarfs
Bordoloi et al. 201X
"""
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
import pdb
import warnings
import os, json, glob, imp
from astropy.table import Table, Column, vstack
from astropy.coordinates import SkyCoord, match_coordin... | 6,939 | 30.402715 | 118 | py |
igmspec | igmspec-master/igmspec/ingest/kodiaq.py | """ Module to ingest KODIAQ Survey data
O'Meara et al. 2016
"""
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
import pdb
import os, json
import imp
import datetime
from astropy.table import Table, Column
from astropy.coordinates import SkyCoord, match_coordin... | 6,761 | 29.597285 | 87 | py |
igmspec | igmspec-master/igmspec/ingest/twodf.py | """ Module to ingest 2dF/6dF quasars
"""
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
import os, json
import pdb
from astropy.table import Table, Column
from astropy.io import fits
from astropy.time import Time
from linetools.spectra import io as lsio
from li... | 8,483 | 29.517986 | 97 | py |
igmspec | igmspec-master/igmspec/ingest/esidla.py | """ Module to ingest High z ESI DLA
Rafelski et al. 2012, 2014
"""
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
import pdb
import os, glob
import imp
import json
from astropy.coordinates import SkyCoord, match_coordinates_sky
from astropy.table import Table, ... | 6,300 | 28.862559 | 111 | py |
igmspec | igmspec-master/igmspec/ingest/hst_cooksey.py | """ Module to ingest HST+FUSE AGN spectra
Cooksey et al. 2010
"""
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
import pdb
import warnings
import os, json
from astropy.table import Table, Column
from astropy.coordinates import SkyCoord, match_coordinates_sky
fr... | 12,809 | 33.904632 | 97 | py |
igmspec | igmspec-master/igmspec/ingest/__init__.py | 0 | 0 | 0 | py | |
igmspec | igmspec-master/igmspec/ingest/ggg.py | """ Module to ingest GGG Survey data
Worseck et al. 2014
"""
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
import pdb
import os
import imp
import json
from astropy.table import Table, Column, vstack
from astropy.time import Time
from linetools.spectra import ... | 5,990 | 27.802885 | 84 | py |
igmspec | igmspec-master/igmspec/ingest/boss.py | """ Module to ingest SDSS III (aka BOSS) data products
"""
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
import os, json
import pdb
import datetime
from astropy.table import Table, Column, vstack
from astropy.time import Time
from astropy.io import fits
from as... | 10,801 | 31.14881 | 108 | py |
igmspec | igmspec-master/igmspec/ingest/cos_halos.py | """ Module to ingest COS-Halos
Tumlinson et al. 2013
"""
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
import pdb
import warnings
import os, json, glob, imp
from astropy.table import Table, Column, vstack
from astropy.coordinates import SkyCoord, match_coordin... | 8,296 | 34.762931 | 177 | py |
igmspec | igmspec-master/igmspec/ingest/tests/test_ingest.py | # Module to run tests on ingest scripts
import os
import pytest
from igmspec.ingest.hdlls import grab_meta
#def data_path(filename):
# data_dir = os.path.join(os.path.dirname(__file__), 'files')
# return os.path.join(data_dir, filename)
def test_hdlls():
if os.getenv('RAW_IGMSPEC') is None:
asser... | 400 | 18.095238 | 64 | py |
igmspec | igmspec-master/igmspec/ingest/tests/__init__.py | 0 | 0 | 0 | py | |
igmspec | igmspec-master/papers/v02_release/py/igmspec_v02_tabs.py | #Module for Tables for the igmspec v02 paper
# Imports
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
import os, sys
import json, yaml
import pdb
from astropy.table import Table
#from astropy import units as u
from specdb.specdb import IgmSpec
# Local
#sys.p... | 4,190 | 27.317568 | 211 | py |
igmspec | igmspec-master/docs/conf.py | # -*- coding: utf-8 -*-
#
# igmspec documentation build configuration file, created by
# sphinx-quickstart on Fri Nov 13 13:39:35 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# A... | 10,057 | 31.031847 | 80 | py |
neural-splines | neural-splines-main/fit-grid.py | import argparse
import numpy as np
import point_cloud_utils as pcu
import torch
import tqdm
from scipy.ndimage import binary_erosion
from skimage.measure import marching_cubes
from neural_splines import load_point_cloud, point_cloud_bounding_box, fit_model_to_pointcloud, eval_model_on_grid, \
voxel_chunks, points... | 13,776 | 60.231111 | 120 | py |
neural-splines | neural-splines-main/trim-surface.py | import argparse
import numpy as np
import point_cloud_utils as pcu
import torch
from neural_splines.geometry import point_cloud_bounding_box
def main():
argparser = argparse.ArgumentParser()
argparser.add_argument("input_points", type=str)
argparser.add_argument("mesh", type=str)
argparser.add_argum... | 2,884 | 47.083333 | 120 | py |
neural-splines | neural-splines-main/fit.py | import argparse
import numpy as np
import point_cloud_utils as pcu
import torch
from skimage.measure import marching_cubes
from neural_splines import load_point_cloud, fit_model_to_pointcloud, eval_model_on_grid, point_cloud_bounding_box
def main():
argparser = argparse.ArgumentParser()
argparser.add_argume... | 9,506 | 60.733766 | 120 | py |
neural-splines | neural-splines-main/neural_splines/falkon_kernels.py | import functools
from abc import ABC
from typing import Optional
import cupy as cp
import numpy as np
import torch
from falkon.kernels import Kernel, KeopsKernelMixin
from falkon.options import FalkonOptions
from falkon.sparse.sparse_tensor import SparseTensor
from torch.utils.dlpack import to_dlpack
def _extract_fl... | 22,944 | 39.183888 | 112 | py |
neural-splines | neural-splines-main/neural_splines/kmeans.py | import pykeops.torch as keops
import torch
def kmeans(x, k, num_iters=10):
"""
Implements Lloyd's algorithm for the Euclidean metric.
:param x: A tensor representing a set of N points of dimension D (shape [N, D])
:param k: The number of centroids to compute
:param num_iters: The number of K means... | 1,649 | 35.666667 | 93 | py |
neural-splines | neural-splines-main/neural_splines/geometry.py | import torch
import numpy as np
from scipy.interpolate import RegularGridInterpolator
def normalize_pointcloud_transform(x):
"""
Compute an affine transformation that normalizes the point cloud x to lie in [-0.5, 0.5]^2
:param x: A point cloud represented as a tensor of shape [N, 3]
:return: An affine... | 7,727 | 39.673684 | 117 | py |
neural-splines | neural-splines-main/neural_splines/__init__.py | import time
import warnings
import point_cloud_utils as pcu
import falkon
from falkon.utils.tensor_helpers import create_same_stride
from .falkon_kernels import NeuralSplineKernel, LaplaceKernelSphere, LinearAngleKernel
from .geometry import *
from .kmeans import kmeans
_VERBOSITY_LEVEL_DEBUG = 0
_VERBOSITY_LEVEL_IN... | 12,994 | 46.600733 | 118 | py |
sequence-jacobian | sequence-jacobian-master/src/sequence_jacobian/misc.py | # to be determined...
from .utilities.optimized_routines import setmin
| 71 | 23 | 48 | py |
sequence-jacobian | sequence-jacobian-master/src/sequence_jacobian/grids.py | # ADD asset_grid in a minute!
from .utilities.discretize import agrid, asset_grid, markov_rouwenhorst, markov_tauchen | 117 | 58 | 87 | py |
sequence-jacobian | sequence-jacobian-master/src/sequence_jacobian/estimation.py | """Functions for calculating the log likelihood of a model from its impulse responses"""
import numpy as np
import scipy.linalg as linalg
from numba import njit
'''Part 1: compute covariances at all lags and log likelihood'''
def all_covariances(M, sigmas):
"""Use Fast Fourier Transform to compute covariance fu... | 3,056 | 34.137931 | 110 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.