Skip to content

Commit

Permalink
Merge pull request #7 from DeepanshS/v0.1.1merge_restructure
Browse files Browse the repository at this point in the history
V0.1.1merge restructure: Using OpenBlas libraries
  • Loading branch information
deepanshs authored Aug 13, 2019
2 parents a27fc54 + a7b0985 commit 2be1835
Show file tree
Hide file tree
Showing 120 changed files with 7,050 additions and 2,725 deletions.
10 changes: 10 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[flake8]
ignore = E741, C901, W503, F401, F841, F811
exclude = .eggs,*.egg,build
filename = *.pyx,*.px*, *py
max-line-length = 88
max-complexity = 18
select = B,C,E,F,W,T4,B9


## E203, E266, E501, F403
37 changes: 20 additions & 17 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ wheels/
.installed.cfg
cython_debug/**
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
Expand All @@ -32,7 +31,6 @@ MANIFEST

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
Expand Down Expand Up @@ -64,8 +62,10 @@ instance/

# Sphinx documentation
docs/_build/
docs/_static/
docs/_templates
docs/api_c

# Doxygen output
doxyoutput/

# PyBuilder
target/
Expand All @@ -76,12 +76,6 @@ target/
# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
Expand All @@ -95,9 +89,6 @@ venv.bak/
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

Expand All @@ -110,14 +101,26 @@ venv.bak/
# build
*.DSYM/**

# folders
src/c_lib/test_c/**

# files
*.out
*.prof
*.ipynb
*.mp4
*.html
*.png
test_os.py

# Cython build file
src/c_lib/mrmethods/nmr_methods.c
note.txt
sideband2.c
dmfit_comparision.py
simulate_lineshape.py
sideband.3
sandbox.c
nmr_methods.c
main.c
mrsimulator.code-workspace
jquery.js
setup.py.src
setup.temp
__config__.json
19 changes: 9 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ default_language_version:
python: python3.7
default_stages: [commit, push, manual]
repos:
- repo: https://github.com/ambv/black
- repo: https://github.com/ambv/black
rev: stable
hooks:
- id: black
Expand All @@ -13,23 +13,23 @@ repos:
types: [python]
files: \.pyi?$

- repo: https://github.com/asottile/blacken-docs
- repo: https://github.com/asottile/blacken-docs
rev: v1.0.0
hooks:
- id: blacken-docs
additional_dependencies: [black==19.3b0]
language: python
language_version: python3.7
- id: blacken-docs
additional_dependencies: [black==19.3b0]
language: python
language_version: python3.7

- repo: https://github.com/pre-commit/pre-commit-hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v1.2.3
hooks:
- id: check-yaml
language: python
- id: check-added-large-files
language: python
# - id: fix-encoding-pragma
# language: python
- id: fix-encoding-pragma
language: python
- id: check-docstring-first
language: python
- id: flake8
Expand All @@ -46,7 +46,6 @@ repos:
language: python
types: [python]


# - repo: https://github.com/asottile/reorder_python_imports
# rev: v1.4.0
# hooks:
Expand Down
20 changes: 20 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py


# Optionally build your docs in additional formats such as PDF and ePub
formats: all

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.7
install:
- requirements: docs/requirements.txt
27 changes: 21 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
os: linux
os:
- linux

dist: xenial
language: python
cache: pip

python:
- "3.6"
- '3.6'
- '3.7.3'

env:
# - PKG1=mkl PKG2=mkl-include
- PKG1=nomkl PKG2=openblas

cache:
pip: true
directories:
- $HOME/.ccache

# safelist
branches:
only:
- master
Expand All @@ -18,11 +32,12 @@ before_install:
- conda info -a
- conda create -q -n test-env python=$TRAVIS_PYTHON_VERSION pytest pytest-cov
- source activate test-env
- conda install fftw mkl-service
- pip install -r requirements.txt
- pip install -r requirements-dev.txt
- conda install -c anaconda $PKG1 $PKG2 --file requirements.txt
- pip install -r requirements-dev.txt

install:
- python setup.py develop

# command to run tests
script:
- pytest
7 changes: 3 additions & 4 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
include README.md
include src/c_lib/lib/*.c
include src/c_lib/mrmethods/*.c
include src/c_lib/include/*.*
include src/c_lib/test/*.*

recursive-include src/mrsimulator/examples *
include src/mrsimulator/isotope_data.json
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ This will display the following message on the screen

1H site 0 from isotopomer 0 @ 100.0% abundance
----------------------------------------------
isotropic chemical shift = 0.0 ppm
chemical shift anisotropy = 13.89 ppm
chemical shift asymmetry = 0.25
Isotropic chemical shift = 0.0 ppm
Shielding anisotropy = 13.89 ppm
Shielding asymmetry = 0.25
Setting up the virtual NMR spectrometer
---------------------------------------
Adjusting the magnetic flux density to 9.4 T.
Expand All @@ -79,9 +79,9 @@ This will display the following message on the screen

1H site 0 from isotopomer 0 @ 100.0% abundance
----------------------------------------------
isotropic chemical shift = 0.0 ppm
chemical shift anisotropy = 13.89 ppm
chemical shift asymmetry = 0.25
Isotropic chemical shift = 0.0 ppm
Shielding anisotropy = 13.89 ppm
Shielding asymmetry = 0.25

and the corresponding plot shown below.

Expand Down
51 changes: 51 additions & 0 deletions dmfit_comparision.py.scr
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
from mrsimulator.miscellaneous import read_dmfit_files
import matplotlib.pyplot as plt
from mrsimulator.python.simulator import simulator
from mrsimulator import Simulator
import numpy as np


def _dmfit():
file_address = '/Users/deepansh/Documents/CSA_20kHz_0.1.txt'

freq, amp = read_dmfit_files(file_address)
max_amp = amp.max()
freq_at_max = freq[np.argmax(amp)]
print(freq_at_max, max_amp)

spectrum = {
"direct_dimension": {
"magnetic_flux_density": "9.4 T",
"rotor_frequency": "0 kHz",
"rotor_angle": "54.735 deg",
"number_of_points": 2048,
"spectral_width": "100 kHz",
"reference_offset": "0 kHz",
"isotope": "1H",
}
}
isotopomers = [
{
"sites": [
{
"isotope": "1H",
"isotropic_chemical_shift": "0 Hz",
"shielding_symmetric": {"anisotropy": "20 kHz", "asymmetry": 0.1},
},
]
}
]
sp = Simulator()
sp.isotopomers = isotopomers
sp.spectrum = spectrum
f, a = simulator(isotopomers=sp._isotopomers_c, spectrum=sp._spectrum_c)
fig, ax = plt.subplots(2, 1)
ax[0].plot(freq, amp / amp.max(), 'r', label='dmfit')
ax[0].plot(f, a / a.max(), 'k', label='mrsimulator')
ax[0].legend()
ax[1].plot(f, (amp / amp.max())[::4] - a / a.max())
plt.show()


if __name__ == '__main__':
_dmfit()
59 changes: 59 additions & 0 deletions docs/Doxyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
# documentation are documented, even if no documentation was available.
# Private class members and static file members will be hidden unless
# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES

EXTRACT_ALL = No

# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
# will be included in the documentation.

EXTRACT_PRIVATE = No

# If the EXTRACT_STATIC tag is set to YES all static members of a file
# will be included in the documentation.

EXTRACT_STATIC = YES

# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
# defined locally in source files will be included in the documentation.
# If set to NO only classes defined in header files are included.

EXTRACT_LOCAL_CLASSES = YES

# This flag is only useful for Objective-C code. When set to YES local
# methods, which are defined in the implementation section but not in
# the interface are included in the documentation.
# If set to NO (the default) only methods in the interface are included.

EXTRACT_LOCAL_METHODS = YES

# If this flag is set to YES, the members of anonymous namespaces will be
# extracted and appear in the documentation as a namespace called
# 'anonymous_namespace{file}', where file will be replaced with the base
# name of the file that contains the anonymous namespace. By default
# anonymous namespace are hidden.

EXTRACT_ANON_NSPACES = NO

# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
# undocumented members of documented classes, files or namespaces.
# If set to NO (the default) these members will be included in the
# various overviews, but no documentation section is generated.
# This option has no effect if EXTRACT_ALL is enabled.

HIDE_UNDOC_MEMBERS = NO

# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
# undocumented classes that are normally visible in the class hierarchy.
# If set to NO (the default) these classes will be included in the various
# overviews. This option has no effect if EXTRACT_ALL is enabled.

HIDE_UNDOC_CLASSES = NO

# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
# friend (class|struct|union) declarations.
# If set to NO (the default) these declarations will be included in the
# documentation.

HIDE_FRIEND_COMPOUNDS = NO
2 changes: 1 addition & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ help:
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -E
Binary file added docs/_static/13C_mas_1kHz.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/13C_static.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/1H_example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/1H_mas_2kHz.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/1H_mas_2khz_90deg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/29Si_mas_1kHz.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 2be1835

Please sign in to comment.