Skip to content

Commit

Permalink
fix imports etc
Browse files Browse the repository at this point in the history
  • Loading branch information
JoranAngevaare committed Dec 3, 2021
1 parent 18de68f commit 224f5e4
Show file tree
Hide file tree
Showing 28 changed files with 102 additions and 110 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/code_style.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Python style
on:
pull_request:
types: [opened]
types: [ opened ]
jobs:
qa:
name: Quality check
Expand All @@ -14,7 +14,7 @@ jobs:
python-version: 3.8
- name: Change __all__ exports for pyflake
run: |
bash .github/scripts/pre_pyflakes.sh
bash .github/scripts/pre_pyflakes.sh
- name: Wemake Python Stylguide
uses: wemake-services/[email protected]
continue-on-error: true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pypi_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: Pipy
on:
workflow_dispatch:
release:
types: [created]
types: [ created ]

jobs:
build:
Expand All @@ -28,5 +28,5 @@ jobs:
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: ${{ secrets.token }}
user: ${{ secrets.token }}
password: ${{ secrets.pypi_password }}
6 changes: 3 additions & 3 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: Test package
on:
workflow_dispatch:
release:
types: [created]
types: [ created ]
pull_request:
push:
branches:
Expand All @@ -18,8 +18,8 @@ jobs:
strategy:
fail-fast: False
matrix:
python-version: [3.7, 3.8, 3.9]
test: ['coveralls', 'pytest']
python-version: [ 3.7, 3.8, 3.9 ]
test: [ 'coveralls', 'pytest' ]
# Only run coverage / no_database on py3.8
exclude:
- python-version: 3.7
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Installation test
on:
workflow_dispatch:
release:
types: [created]
types: [ created ]
pull_request:
branches:
- master
Expand All @@ -19,7 +19,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.8]
python-version: [ 3.8 ]
steps:
- name: Setup python
uses: actions/setup-python@v2
Expand Down
19 changes: 10 additions & 9 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
1.0.0 / 2021-12-02
------------------
- Add badges to Amstrax and update readme (#23)
- Plugin, context and package structure (#24)
- Fix autoprocessing scripts (#25)
- Delete bootstrax (#26)
- remove notebooks (#27)
- Add documentation

- Add badges to Amstrax and update readme (#23)
- Plugin, context and package structure (#24)
- Fix autoprocessing scripts (#25)
- Delete bootstrax (#26)
- remove notebooks (#27)
- Add documentation

0.1.0 / 2021-12-02
--------------------
- Add testing and restructure amstrax (#13)

- Add testing and restructure amstrax (#13)

0.0.1 / <2021-12-01
--------------------
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
# Amstrax

[![Coverage Status](https://coveralls.io/repos/github/XAMS-nikhef/amstrax/badge.svg?branch=master)](https://coveralls.io/github/XAMS-nikhef/amstrax?branch=master)
[![CodeFactor](https://www.codefactor.io/repository/github/xams-nikhef/amstrax/badge)](https://www.codefactor.io/repository/github/xams-nikhef/amstrax)
[![PyPI version shields.io](https://img.shields.io/pypi/v/amstrax.svg)](https://pypi.python.org/pypi/amstrax/)
[![PyPI downloads](https://img.shields.io/pypi/dm/amstrax.svg)](https://pypistats.org/packages/amstrax)
[![DOI](https://zenodo.org/badge/263576054.svg)](https://zenodo.org/badge/latestdoi/263576054)

## Documentation

[![Documentation Status](https://readthedocs.org/projects/amstrax/badge/?version=latest)](https://amstrax.readthedocs.io/en/latest/?badge=latest)

Amsterdam Strax

Amstrax is the analysis framework for XAMS, built on top of the generic [strax framework](https://github.com/AxFoundation/strax).
Amstrax is the analysis framework for XAMS, built on top of the
generic [strax framework](https://github.com/AxFoundation/strax).

# Installation

For installing the package do the regular install-packages-from-github tricks:

```
pip install amstrax
```

All required dependencies will be installed for you.

# Usage
First you'll need to get some data. For this you'll need to either run somewhere where nikhef's /data/xenon/xams is available or have data downloaded.
Either strax processed data or pax raw data is fine.
Once you have data you can try running the Tutorial notebook (although it's in Dutch), just make sure to change the output_folder to where you have data

First you'll need to get some data. For this you'll need to either run somewhere where nikhef's
/data/xenon/xams is available or have data downloaded. Either strax processed data or pax raw data
is fine. Once you have data you can try running the Tutorial notebook (although it's in Dutch), just
make sure to change the output_folder to where you have data
11 changes: 3 additions & 8 deletions amstrax/SiPMdata.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
from iminuit import Minuit
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

from copy import deepcopy

import matplotlib
import matplotlib.pyplot as plt
from IPython.display import clear_output
from iminuit import Minuit
from matplotlib.colors import BoundaryNorm
from matplotlib.ticker import MaxNLocator

from IPython.display import clear_output

np.random.seed(12345)
inch = 25.4 # mm

Expand Down
15 changes: 6 additions & 9 deletions amstrax/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
__version__ = '0.1.0'

from . import auto_processing
from . import hitfinder_thresholds
from .hitfinder_thresholds import *

from . import plugins
from .common import *
from .itp_map import *
from .rundb import *
from .contexts import *
from .hitfinder_thresholds import *

from . import plugins
from .hitfinder_thresholds import *
from .itp_map import *
from .plugins import *

from .contexts import *
from . import auto_processing
from .rundb import *
3 changes: 1 addition & 2 deletions amstrax/auto_processing/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from . import amstraxer
from . import submit_stbc

from . import auto_processing
from . import process_run
from . import submit_stbc
7 changes: 4 additions & 3 deletions amstrax/auto_processing/amstraxer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
"""
import argparse
import datetime
import json
import logging
import time
import os
import os.path as osp
import platform
import psutil
import sys
import json
import time

import psutil


def parse_args():
Expand Down
2 changes: 1 addition & 1 deletion amstrax/auto_processing/auto_processing.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import time
import argparse
import time


def parse_args():
Expand Down
3 changes: 2 additions & 1 deletion amstrax/auto_processing/submit_stbc.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import argparse
import os

from amstrax import amstrax_dir

script_template = """#!/bin/bash
Expand Down
11 changes: 4 additions & 7 deletions amstrax/common.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import socket
import sys
import os.path as osp
import os
import inspect
import urllib.request
import tarfile
import io
import os
import tarfile

import numpy as np
import straxen
import strax
import straxen

export, __all__ = strax.exporter()
__all__ += ['amstrax_dir', 'to_pe']
Expand Down
4 changes: 3 additions & 1 deletion amstrax/contexts.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import os
from datetime import timezone

import strax
import amstrax as ax
from immutabledict import immutabledict

import amstrax as ax

common_opts = dict(
# register_all=[ax.pulse_processing,
# ax.peak_processing,
Expand Down
2 changes: 1 addition & 1 deletion amstrax/hitfinder_thresholds.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import numpy as np

import strax

import amstrax

export, __all__ = strax.exporter()
Expand Down
5 changes: 2 additions & 3 deletions amstrax/itp_map.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import logging
import gzip
import json
import logging
import re

import numpy as np
from scipy.spatial import cKDTree

import strax
from scipy.spatial import cKDTree

export, __all__ = strax.exporter()

Expand Down
22 changes: 8 additions & 14 deletions amstrax/plugins/__init__.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
from . import daqreader
from .daqreader import *

from . import event_processing
from . import pax_interface
from . import peak_processing
from . import peak_processing
from .peak_processing import *

from . import pulse_processing
from .pulse_processing import *

from . import pulse_processing_alt_baseline
from .pulse_processing_alt_baseline import *

from . import peak_processing
from .peak_processing import *

from . import event_processing
from .daqreader import *
from .event_processing import *

from . import pax_interface
from .pax_interface import *
from .peak_processing import *
from .peak_processing import *
from .pulse_processing import *
from .pulse_processing_alt_baseline import *
3 changes: 2 additions & 1 deletion amstrax/plugins/daqreader.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import glob
import warnings
from immutabledict import immutabledict

import numpy as np
import strax
import straxen
from immutabledict import immutabledict
from straxen.plugins.daqreader import split_channel_ranges

export, __all__ = strax.exporter()
Expand Down
2 changes: 1 addition & 1 deletion amstrax/plugins/event_processing.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import strax
import numpy as np
import strax
from amstrax.SiPMdata import *

export, __all__ = strax.exporter()
Expand Down
7 changes: 4 additions & 3 deletions amstrax/plugins/pax_interface.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
"""Convert pax .zip files to flat records format
"""
import numpy as np
import os
import glob
import os

import numba
from straxen.plugins.pax_interface import records_needed
import numpy as np
import strax
from straxen.plugins.pax_interface import records_needed

export, __all__ = strax.exporter()

Expand Down
5 changes: 2 additions & 3 deletions amstrax/plugins/peak_processing.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import numpy as np
import numba
from amstrax.SiPMdata import *

import numpy as np
import strax
from amstrax.SiPMdata import *

export, __all__ = strax.exporter()

Expand Down
4 changes: 2 additions & 2 deletions amstrax/plugins/pulse_processing.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from immutabledict import immutabledict
import numba
import numpy as np

import strax
from immutabledict import immutabledict

import amstrax

export, __all__ = strax.exporter()
Expand Down
10 changes: 5 additions & 5 deletions amstrax/rundb.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import os
import re
import typing
import socket
from sshtunnel import SSHTunnelForwarder
from tqdm import tqdm
import pymongo
import typing

import pymongo
import strax
from sshtunnel import SSHTunnelForwarder
from tqdm import tqdm

export, __all__ = strax.exporter()

Expand Down Expand Up @@ -107,7 +107,7 @@ def __init__(self,
self.local_only = local_only
self.new_data_path = new_data_path
self.reader_ini_name_is_mode = reader_ini_name_is_mode
self.readonly=readonly
self.readonly = readonly
if self.new_data_path is None:
self.readonly = True

Expand Down
Loading

0 comments on commit 224f5e4

Please sign in to comment.