Skip to main content

Fit a Lognormal + Power law distribution to data

Project description

PDF_Fit

A code to fit the LN+PL or LN+2PL form to the density PDF of star forming regions. To use this:

pip install pdffit

Once you have installed, you can use the following sample script -

from fitter import *
import numpy as np


sample_data = np.load('./sample_data.npz')

#xdata and ydata are just two arrays. 
xdata = sample_data['arr_0']
ydata = sample_data['arr_1']
sink = float(sample_data['arr_2'])

params = Params(s_cut_off = sink)

p0 = [1.7, 1.6, 0.8, 7.1]
PLPLresult = PLPLFit(xdata, ydata, p0, params, use_K21=True)

p0 = [1.85, 1.57]
PLresult = PLFit(xdata, ydata, p0, params)

print (PLresult.sigma_err, PLresult.alpha_err, PLPLresult.sigma_err, PLPLresult.sb)
#To know more about how to access the result: help(Result)

In case you want to dig deeper or just use the function for plotting:

from LNPLPL_functions import *
from LNPL_functions import *

or whichever way you wish to import the modules and the functions within them.

To get help on any function:

help(function_name)

If you're on the pypi page, please checkout the github version to get the sample data if you need.

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdffit-0.1.tar.gz (125.7 kB view details)

Uploaded Source

Built Distribution

pdffit-0.1-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file pdffit-0.1.tar.gz.

File metadata

  • Download URL: pdffit-0.1.tar.gz
  • Upload date:
  • Size: 125.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.6.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

File hashes

Hashes for pdffit-0.1.tar.gz
Algorithm Hash digest
SHA256 8b356ab1885a1d31302ecb6765e48b2b85d39bff1e63bc839377811287ba82d6
MD5 4e3676ddfbb7364b303fedf08ececd68
BLAKE2b-256 cfe6816c29db5646612e5f81ae4c9779823218eaa089110c629954d767f227f1

See more details on using hashes here.

File details

Details for the file pdffit-0.1-py3-none-any.whl.

File metadata

  • Download URL: pdffit-0.1-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.6.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

File hashes

Hashes for pdffit-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6c82a02c12166ba32c168fc0c2c21864138c886ff266472b9ac2b083071f1393
MD5 1ae256f15d557009ca89430c648c28ed
BLAKE2b-256 8e1b455dc43725e2abf3870d720758abe04cb3a858c0b2c037f139fa56c40146

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page