Coder Social home page Coder Social logo

changing directory about chaste HOT 4 CLOSED

 avatar commented on June 23, 2024
changing directory

from chaste.

Comments (4)

BJackal avatar BJackal commented on June 23, 2024

Hi there Mobinat,

This looks like it could be a relative path vs absolute path issue as in the changing directory it seems to call "/home/mobina/chaste_libs/chaste_build/ python//home/mobina /chaste_libs/chaste_build/python/" twice as well as the directory its trying to change to "/home/mobina/chaste_libs/ Chaste//home/mobina/ chaste_libs/Chaste/". If you could provide your python script which you have changed here we may be able to offer more assistance.

I see you have also specifically opened an issue on the erk_waves repository itself which is great. It seems that the repository owner has recently updated the python file directly. Did their change fix this issue ?

from chaste.

 avatar commented on June 23, 2024

the recent changes made in python file still makes the path error as code block bellow. "batch_erk_propulsion_no_alignment.py"; do you have any clue why are path and logic errors showing up?

this is the way I am running this project. first I git clone template_project and follow configuring and testing steps. then I replace erk_wave project with it and recompile it and re-make the test. the executable file is made but the python file returns following block. I also tried compiling and building erk_wave in co-existance with template_project. it didn't work. the furthest I got is here, there is also some errors occuring when I complile template_project and defining the template_project consisting of all types of cells. for me there is something wrong with heart-cell part. but it doesn't matter because erk_wave is only cell_based and I can avoid that problem by only defining cell_based when running python setup.py.

but this logic_errors and path, I can't figure them out.

Running 1 testRunning 1 test

Changing directory from 'Changing directory from '/home/mobina/chaste_libs/chaste_build/projects/erk_waves/python//home/mobina/chaste_libs/chaste_build/projects/erk_waves/python/' to '' to '/home/mobina/chaste_libs/Chaste//home/mobina/chaste_libs/Chaste/'.'.

CWD now: CWD now: /home/mobina/chaste_libs/Chaste/home/mobina/chaste_libs/Chaste



 ***** TestERKWaveWithSelfPropulsion

 ***** .hpp *****

TestERKWaveWithSelfPropulsion
.hpp *****

Entering 
TestRunSimulationEntering 
TestRunSimulation
terminate called after throwing an instance of 'std::logic_errorterminate called after throwing an instance of ''
std::logic_error'
  what():    what():  basic_string: construction from null is not validbasic_string: construction from null is not valid

Process not complete  [PosixPath('/home/mobina/chaste_libs/chaste_build/projects/erk_waves/test/TestERKWaveWithSelfPropulsionNoAlignment'), '-nx', '44', '-ny', '44', '-dt', '0.01', '-dt_ode', '0.01', '-init_erk', '0.0', '-init_A0', '1.0', '-init_noise', '0.01', '-taul', '20.0', '-tau_p', '5.0', '-KA', '1.2', '-KP', '0.38244', '-check_for_internal_intersections', '0', '-F0', '0.15', '-ab_ratio', '18.5', '-n_abcrit', '1.8', '-end_time', '1177.0', '-bonus_time', '118.0', '-sampling_timestep_multiple', '50', '-seed', '1', '-P0', '3.8', '-outdir', 'erk_waves_output/_nx_44_dt_0.01_P0_3.8000_n_abcrit_1.8_ab_ratio_18.5000_F0_0.15_tau_p_5.0_seed_1']
Process not complete  [PosixPath('/home/mobina/chaste_libs/chaste_build/projects/erk_waves/test/TestERKWaveWithSelfPropulsionNoAlignment'), '-nx', '44', '-ny', '44', '-dt', '0.01', '-dt_ode', '0.01', '-init_erk', '0.0', '-init_A0', '1.0', '-init_noise', '0.01', '-taul', '20.0', '-tau_p', '5.0', '-KA', '1.2', '-KP', '0.38244', '-check_for_internal_intersections', '0', '-F0', '0.15', '-ab_ratio', '18.5', '-n_abcrit', '1.8', '-end_time', '1177.0', '-bonus_time', '118.0', '-sampling_timestep_multiple', '50', '-seed', '1', '-P0', '3.5', '-outdir', 'erk_waves_output/_nx_44_dt_0.01_P0_3.5000_n_abcrit_1.8_ab_ratio_18.5000_F0_0.15_tau_p_5.0_seed_1']

this is the python file as you can find in erk_wave.

# Script to specify sets of model parameters and launch vertex model
# simulations of these sets as separate processes
import numpy as np

def calc_omega(taue, taul):
    """Calculate the predicted angular frequency of oscillation

    Prediction from linear stability of the 1d model presented in
    Boocock et al NatPhys (2021) DOI:10.1038/s41567-020-01037-7.

    taue: timescale for decay of ERK activation
    taul: timescale for decay of rest length / rest area

    Return: (double) angular frequency

    """
    p1 = 1/(taul**(1/2) * taue**(3/2))
    p2 = 1/(taul**(3/2) * taue**(1/2))
    p3 = 1/(taul*taue)
    return np.sqrt(p1 + p2 + p3)


def calc_period(taue, taul):
    """Calculate the predicted period of oscillation

    Prediction from linear stability of the 1d model presented in
    Boocock et al NatPhys (2021) DOI:10.1038/s41567-020-01037-7.

    taue: timescale for decay of ERK activation
    taul: timescale for decay of rest length / rest area

    Return: (double) period
    """
    return 2*np.pi / calc_omega(taue, taul)


if __name__ == "__main__":
    from run_batch import create_args_arr, launch_subprocess
    from multiprocessing import Pool
    from pathlib import Path

    # Path to executable within chaste_build (You may need to change
    # this line to specify the path to the executable on your own
    # system)
    # executable = Path(*Path.cwd().parts[:-4],
    #                   "chaste_build/projects/erk_waves/test",
    #                   "TestERKWaveWithSelfPropulsionNoAlignment")
    # For Docker installation
    executable = Path("/home/mobina/chaste_libs/chaste_build/projects/erk_waves/test/TestERKWaveWithSelfPropulsionNoAlignment")

    # Specify a root directory (or stem) for simulation output. This
    # will appear within the directory specified by the environment
    # variable "CHASTE_TEST_OUTPUT" and contain output from the
    # simulations launched in this script.
    outdir_stem = "erk_waves_output/"

    # Specify the parameters used to label the output directory (a
    # separate file "params.txt" containing all parameters and values
    # will be generated withing the directory)
    outdir_labels = ["nx", "dt", "P0", "n_abcrit", "ab_ratio", "F0", "tau_p", "seed"]

    # Specify sets of model simulation parameters

    dt = 0.01    # timestep for vertex and ODE solver (I keep these the same)

    # Specify the parameters and values that are common across all
    # simulations
    const_arg_dict = {
        "-nx": 44,    # Number of cells in x
        "-ny": 44,    # Number of cells in y
        "-dt": dt,
        "-dt_ode": dt,

        # "-sampling_timestep_multiple": 5*int(0.1/dt),    # Save n*(ten times per T)

        # Initial mean values of variables
        "-init_erk": 0.0,
        "-init_A0": 1.0,    # Initial rest length in units of average cell area

        # Specify the noise magnitude (std) of initial perturbation in
        # vertex positions and ERK activity
        "-init_noise": 0.01,

        # Timescale associated with changes in preferred perimeter
        "-taul": 20.0,    # Non-dimensionalized by tauE=6min (timescale of ERK)
        # Persistence timescale of persistent random walk
        "-tau_p": 5.0,    # non-dimensionalized by tauE (30mins if tauE=6min)

        # Area and perimeter elasticity. Ratio of KA/KP taken from
        # Henkes et al NatCom (2020) (same as used in Saraswathibhatla
        # et al (2021)) with magnitudes (equiv substrate friction)
        # rescaled to give a wavelength of approx 20 cells. See table
        # in supplementary material of Boocock et al (2023)
        # doi:10.1101/2023.03.24.534111. The mechanical timescale
        # tau_r from the 1D model in Boocock et al (2021) goes like
        # ~1/(2*KA).
        "-KA": 4*0.3,
        "-KP": 4*0.09561,

        # Specify whether to check for internal intersections (0 for
        # True, 1 for False)
        "-check_for_internal_intersections": 0,

        # Self-propulsion force magnitude (or rather F0/\zeta, i.e. scaled by friction)
        "-F0": 0.15,
        # Ratio of mechanochemical coupling strengths alpha/beta
        "-ab_ratio": 18.5,
        # Magnitude of mechanochemical coupling strength alpha*beta as
        # a multiple of the prediction for the onset of stability from
        # linear stability analysis of the 1D model (see Boocock et al
        # 2021)
        "-n_abcrit": 1.8,
    }


    # Timescale of ERK activation used to non-dimensionalize
    tau_e = 1.0
    # Specify the length of the burn-in period (in terms of the
    # predicted period of oscillation)
    const_arg_dict["-end_time"] = np.round(100*calc_period(tau_e, const_arg_dict["-taul"]))
    # Specify the length of the data capture period (in terms of the
    # predicted period of oscillation)
    const_arg_dict["-bonus_time"] = np.round(10*calc_period(tau_e, const_arg_dict["-taul"]))
    # Specify a sampling interval for the data capture period
    const_arg_dict["-sampling_timestep_multiple"] = 5*int(0.1/dt)

    # Parameter lists within this dictionary are paired by index,
    # i.e. p1[i] with p2[i]. Lists should be of the same length.
    paired_arg_dict = {
    }


    # Dimensionless shape index P0/Sqrt(A0) controlling tissue
    # rigidity (see e.g. Bi et al NatPhys (2015)
    # https://doi.org/10.1038/nphys3471)
    p0 = np.array([
        3.5,
        3.8,
        ])

    # Run simulation for all combinations of parameter values within
    # the lists in this dictionary
    comb_arg_dict = {
        "-seed": [1],    # Random seeds
        "-P0": p0,
    }

    # Create arrays of arguments for different simulation
    # parameterizations to be passed to the executable and run as
    # separate processes
    args_arr = create_args_arr(executable,
                               const_arg_dict,
                               paired_arg_dict,
                               comb_arg_dict,
                               outdir_labels,
                               dir_name=outdir_stem)

    # Launch the simulations as separate subprocesses
    n_cpus = 2    # Number of simultaneous processes to run, i.e
                  # number of cores to use with each parameterization
                  # run on a separate core.
    with Pool(n_cpus) as p:
        p.map(launch_subprocess, args_arr)

from chaste.

BJackal avatar BJackal commented on June 23, 2024

Thanks for the reply Mobinat,

Just to be sure is this how you setup the project folder for erk_waves:

(After downloading an running the chaste setup)
"cd Chaste/projects"
"git clone https://github.com/DBoocock/erk_waves.git"
"cd erk_waves"
run ~ "python setup_project.py"
make a build or chaste_build directory outside of the main chaste folder
"cd path/to/chaste_build"
"ccmake path/to/Chaste" # running configure first (c), then running configure again (c) then running generate (g).
After running the configure and generation steps do you get any errors ?
make TestERKWaveWithSelfPropulsionNoAlignment

You shouldn't need to download or run the template project as any stand alone project such as erk_waves should work by itself when ran using the above steps.

The following line is slightly confusing "/home/mobina/chaste_libs/Chaste/home/mobina/chaste_libs/Chaste" as it appears to have tried to cd into an area that is just a doubling of the same file path. What is the directory that Chaste is installed in and where is the build folder compared to that ? is it /home/mobina/Chaste and /home/mobina/build for example.

Are you running this in docker or natively on a linux machine ?

I have also noticed in your original post that it seems you are executing the command from "/chaste_libs/chaste_build/python$" this seems a little strange as the build folder you have created should have a projects directory with the erk_waves folder within it. Does this folder exist within your folder ? Also can you successfully run a single version of the test file by itself without running the parallel python executable ?

from chaste.

BJackal avatar BJackal commented on June 23, 2024

This issue has been marked as resolved.

from chaste.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.