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

specs definitions #11

Open
Mobinati opened this issue Jun 12, 2024 · 2 comments
Open

specs definitions #11

Mobinati opened this issue Jun 12, 2024 · 2 comments

Comments

@Mobinati
Copy link

I am using Tyssue, and It's well-structured. thanks a lot.
Just had a question,
how is it possible to define the specs like prefered_area or prefered_perimeter not be unique for all cells in the tissue. how can we apply the energy minimization in a way that prefered_area or prefered_area be defined by a function and be specific for each cell?

sheet = Sheet.planar_sheet_2d('flat', 30, 30, 1, 1, noise=0.2)
to_cut = sheet.cut_out([(0.1, 6), (0.1, 6)])
sheet.remove(to_cut, trim_borders=True)
sheet.sanitize(trim_borders=True)
geom.center(sheet)
geom.update_all(sheet)
sheet.update_rank()
model = model_factory(
    [
        effectors.LineTension,
        effectors.FaceContractility,
        effectors.FaceAreaElasticity
    ]
)

specs = {
    "face": {
        "contractility": 5e-2,
        "prefered_area": sheet.face_df.area.mean(),
        "area_elasticity": 1.
    },
    "edge": {
        "line_tension": 1e-2,
        "is_active": 1
    },
    "vert": {
        "is_active": 1
    },
}
@glyg
Copy link
Member

glyg commented Jun 17, 2024

Hi @Mobinati thank your for your interest in using tyssue!

Specs are used to set default uniform values for the parameter, but you can later change those for specific cells by updating the value in the sheet.face_df dataframe. For example, if you want the central cell to have a prefered area that depends on some function of their position, you can run:

sheet.face_df["prefered_area"] = A0 * sheet.face_df['x']**2

Of course this is an artificial example ;)
The important point is that what's used in the computation of the energy terms for example depends on the values in the face_df, edge_df and vert_df dataframes, and you can change the parameter values on any line of those pandas dataframes.

Hope this helps,

Best
G

@Mobinati
Copy link
Author

Mobinati commented Jul 1, 2024

thanks a lot for the hint, actually I made a Custome function which works fine. but I have another issue with periodic boundaries.

how can I have a square box with cells connected to their front sides? for example for this tissue:

sheet = Sheet.planar_sheet_2d(
    'basic2D', # a name or identifier for this sheet
    nx=20, # approximate number of cells on the x axis
    ny=20, # approximate number of cells along the y axis
    distx=1, # distance between 2 cells along x
    disty=1 # distance between 2 cells along y
)
sgeom.update_all(sheet)

I already have tried these but didn't work.

spec["settings"].update({"boundaries": {"x": [1, 18], "y": [1, 18]}})

sheet = Sheet("periodic", model_specs)

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

No branches or pull requests

2 participants