Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation query #167

Open
makeabhishek opened this issue Mar 28, 2023 · 3 comments
Open

Installation query #167

makeabhishek opened this issue Mar 28, 2023 · 3 comments

Comments

@makeabhishek
Copy link

makeabhishek commented Mar 28, 2023

Hi,
I installed seisflows following the latest instructions.

git clone --branch devel https://github.com/adjtomo/seisflows.git
cd seisflows
conda env create -f environment.yml
conda activate seisflows
pip install -e .

I'm aware that SPECFEM is not the part of seisflow. But I want to confirm if we need to install SPECFEM separately?
Does SPECFEM directory need to be inside seisflows or anywhere is fine?

Thanks
Abhi

@bch0w
Copy link
Member

bch0w commented Mar 28, 2023

Hi @makeabhishek, great question. Yes, SPECFEM will need to be installed and compiled separately for your machine, and you will have to choose which version of SPECFEM (2D/3D/3D_GLOBE) you need for your application.

SPECFEM does not need to be within SeisFlows. In the SeisFlows parameter file, you will just need to specify paths to the bin/, DATA/ and DATABASES_MPI/ directories of SPECFEM.

One caveat of this is that the example problems are capable of downloading and compiling SPECFEM2D on a workstation, however in most cases I'd recommend the User do this themselves as it gives more flexibility and control over how SPECFEM is compiled.

@makeabhishek
Copy link
Author

Thanks @bch0w for the guidance. I was trying to run pytest for seisflows. But I got the following error.

(seisflows) teamacoustics@teamacoutics:~/Documents/seisflows/seisflows/tests$ pytest
============================= test session starts ==============================
platform linux -- Python 3.11.0, pytest-7.2.2, pluggy-1.0.0
rootdir: /home/teamacoustics/Documents/seisflows
collected 32 items                                                             

test_optimize.py ..........                                              [ 31%]
test_preprocess.py ........                                              [ 56%]
test_seisflows.py .....                                                  [ 71%]
test_solver.py F..                                                       [ 81%]
test_system.py ....                                                      [ 93%]
test_tools.py ..                                                         [100%]

=================================== FAILURES ===================================
______________________________ test_source_names _______________________________

    def test_source_names():
        """
        Check that source names are established correctly
        """
        # Establish solver that looks for CMTSOLUTIONS with NTASK==1
        sources = os.path.join(TEST_DATA, "sources")
        solver = Specfem(path_specfem_data=sources, source_prefix="CMTSOLUTION")
        assert(len(solver.source_names) == 1)
    
        # Set NTASK==2 to grab both source files
        solver = Specfem(path_specfem_data=sources, source_prefix="CMTSOLUTION",
                         ntask=2)
        source_names = glob(os.path.join(sources, "CMTSOLUTION*"))
        source_names = [_.split("_")[-1] for _ in source_names]
    
>       assert(source_names == solver.source_names)
E       AssertionError: assert ['002', '001'] == ['001', '002']
E         At index 0 diff: '002' != '001'
E         Use -v to get more diff

/home/teamacoustics/Documents/seisflows/seisflows/tests/test_solver.py:31: AssertionError
=============================== warnings summary ===============================
../../../../anaconda3/envs/seisflows/lib/python3.11/site-packages/pkg_resources/__init__.py:121
  /home/teamacoustics/anaconda3/envs/seisflows/lib/python3.11/site-packages/pkg_resources/__init__.py:121: DeprecationWarning: pkg_resources is deprecated as an API
    warnings.warn("pkg_resources is deprecated as an API", DeprecationWarning)

../../../../anaconda3/envs/seisflows/lib/python3.11/site-packages/pkg_resources/__init__.py:2870
  /home/teamacoustics/anaconda3/envs/seisflows/lib/python3.11/site-packages/pkg_resources/__init__.py:2870: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('mpl_toolkits')`.
  Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
    declare_namespace(pkg)

seisflows/tests/test_preprocess.py: 24 warnings
  /home/teamacoustics/anaconda3/envs/seisflows/lib/python3.11/site-packages/pyasdf/asdf_data_set.py:282: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    self._loose_asdf_format_version = LooseVersion(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED test_solver.py::test_source_names - AssertionError: assert ['002', '001'] == ['001', '002']
================== 1 failed, 31 passed, 26 warnings in 58.09s ==================
(seisflows) teamacoustics@teamacoutics:~/Documents/seisflows/seisflows/tests$ 

@bch0w
Copy link
Member

bch0w commented Mar 29, 2023

Thanks for catching that, @makeabhishek! Interestingly that test passes on my workstation, I guess that's why they caution that lists in Python are liable to change! I will make sure to fix that test in the next update. Just leaving a to-do here so that I remember.

To Do:

  • sort source names before assertion in test_solver.test_source_names()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants