Adolfo1519 / RotBroadInt

A repository for the simple integration-based rotational broadening code
4 stars 0 forks source link

Input Parameters #1

Open SergeWSU opened 11 months ago

SergeWSU commented 11 months ago

Hi Sorry to open an issue but I could not find email contact details.

Can you please tell me the syntax for the input parameters w (what is the wavelength scale) and s (do we enter the flux for each wavelength?)

Regards

Serge

Adolfo1519 commented 11 months ago

Hi Serge,

The wavelength scale (w) and input spectrum (s) should both be 1d arrays of the same length, where s gives the flux value at each element of w. The wavelength scale and flux can be in any units.

Best, Adolfo

SergeWSU commented 11 months ago

Hi Thanks. You don't have to answer as its not your problem.

As a test I am running the script below - unfortunately it doesn't lead to an output. No error reported

Regards Serge

import numpy as np

def rot_int_cmj(w, s, vsini=14, eps=0.6, nr=10, ntheta=100, dif = 0.0):

w = [8460, 8461, 8462, 8465, 8466, 8467, 8468, 8469, 8470]
s = [1125, 1124, 1123, 1122, 1123, 1124, 1125, 1126, 1125]
ns = np.copy(s)*0.0
tarea = 0.0
dr = 1./nr
for j in range(0, nr):
    r = dr/2.0 + j*dr
    area = ((r + dr/2.0)**2 - (r - dr/2.0)**2)/int(ntheta*r) * (1.0 - eps + eps*np.cos(np.arcsin(r)))
    for k in range(0,int(ntheta*r)):
        th = np.pi/int(ntheta*r) + k * 2.0*np.pi/int(ntheta*r)
        if dif != 0:
            vl = vsini * r * np.sin(th) * (1.0 - dif/2.0 - dif/2.0*np.cos(2.0*np.arccos(r*np.cos(th))))
            ns += area * np.interp(w + w*vl/2.9979e5, w, s)
            tarea += area
        else:
            vl = r * vsini * np.sin(th)
            ns += area * np.interp(w + w*vl/2.9979e5, w, s)
            tarea += area

return ns/tarea

From: Adolfo Carvalho @.> Sent: Wednesday, 22 November 2023 12:07 AM To: Adolfo1519/RotBroadInt @.> Cc: Serge Wadhwa @.>; Author @.> Subject: Re: [Adolfo1519/RotBroadInt] Input Parameters (Issue #1)

Hi Serge,

The wavelength scale (w) and input spectrum (s) should both be 1d arrays of the same length, where s gives the flux value at each element of w. The wavelength scale and flux can be in any units.

Best, Adolfo

— Reply to this email directly, view it on GitHubhttps://github.com/Adolfo1519/RotBroadInt/issues/1#issuecomment-1820892503, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BAWQGTQLWMDMRVULQXRIK3DYFSRQHAVCNFSM6AAAAAA7ULRGQKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRQHA4TENJQGM. You are receiving this because you authored the thread.Message ID: @.***>

Adolfo1519 commented 11 months ago

Hi Serge,

This does not seem to be correct usage of the function. The w and s arrays should be inputs to the already defined rot_int function. The output would be the broadened spectrum.

Furthermore there is no actual call to the function in this script. So naturally if you run the script there will be no output.

Best, Adolfo