Skip to content

How to make an averaged radial profile of a disk? #71

Answered by nvaytet
nvaytet asked this question in Q&A
Discussion options

You must be logged in to vote

This example shows how to make a 1D profile of the mean gas density as a function of radius.

import osyris
import numpy as np
import matplotlib.pyplot as plt

path = "osyrisdata/starformation"
data8 = osyris.Dataset(8, scale="au", path=path).load()

# Find center
ind = np.argmax(data8["hydro"]["density"])
center = data8["amr"]["xyz"][ind.values]

# Re-center cell coordinates according to origin
data8['amr']['xyz_new'] = data8['amr']['xyz'] - center

# Create figure
fig, ax = plt.subplots()

# Make scatter plot as radial profile
step = 100
osyris.scatter(data8['amr']['xyz_new'][::step],
               data8['hydro']['density'][::step],
               c='grey', edgecolors='None', loglog=True, 

Replies: 1 comment

Comment options

nvaytet
Feb 9, 2022
Maintainer Author

You must be logged in to vote
0 replies
Answer selected by nvaytet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant