Open Aaydee0555 opened 2 months ago
Can you send a simple script that illustrates your issue?
Thank you for your response. Please find the Python script attached below where I am facing the issue. I am looking forward to your assistance in resolving this issue.
Regards, Athar Ahmad Dar Research Scholar Department of Physics University of Kashmir, 190006 +91-7006361913
On Tue, May 14, 2024 at 2:34 AM Nicola Omodei @.***> wrote:
Can you send a simple script that illustrates your issue?
— Reply to this email directly, view it on GitHub https://github.com/fermiPy/fermipy/issues/591#issuecomment-2108796817, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXSOYO5VJJRM2Z2ANCILNGLZCETFDAVCNFSM6AAAAABHMKESSOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBYG44TMOBRG4 . You are receiving this because you authored the thread.Message ID: @.***>
I am sorry, there is no script attached here, probably you attached via email, can you use the web interface to upload a test sample? Thank you!
from fermipy.gtanalysis import GTAnalysis import numpy as np import shutil
gta = GTAnalysis('config.yaml', logging={'verbosity': 3}) gta.setup() gta.free_sources(distance=3.0, pars='norm') gta.free_source('galdiff') gta.free_source('isodiff') gta.free_sources(minmax_ts=[10, None], pars='norm') gta.free_source('4FGL J1642.9+3948')
source_name = 4FGL J1642.9+3948' source = gta.roi.get_source_by_name(source_name) print(f"Source: {source_name}") param_names = ['Prefactor', 'Index1', 'Index2', 'BreakValue'] param_values = source['param_values']
gta.fit()
break_energies = np.loadtxt('break_energy.txt')
tmin = 620581417 n = 6 # Assuming 46 one-month bins time_bins = [tmin + 30 i 86400 for i in range(n)]
for i in range(len(time_bins)-1):
#gta.load_roi('config.yaml')
# Fix the break energy for this time bin
param_values[3] = break_energies[i]
time_bin=[time_bins[i], time_bins[i+1]]
# Generate the light curve
lc = gta.lightcurve('4FGL J1642.9+3948', time_bins=time_bin, free_radius=3.0, use_local_ltcube=False, multithread=True) # I want to freeze the break energy of my source to the break_energies[i] value, please suggest if we can do it in gta.lightcurve
shutil.copy(f'4fgl_j1642.9+3948_lightcurve.npy', f'{i}.npy')
shutil.copy(f'4fgl_j1642.9+3948_lightcurve.fits', f'{i}.fits')
I am writing to seek your guidance regarding an issue I am facing with my Fermipy analysis. I use the gta.lightcurve command to obtain the 10-day binned gamma-ray light curve. A broken power law model is used for the source model. My goal is to fix the break energy of the model to the specific values in each bin. In each time bin, I have a specific value of the break energy. However, I have encountered a challenge where the break energy takes the value by default, and I cannot fix it to the energy as intended. I have reviewed the Fermipy documentation and explored various options within the code, but I have not been able to resolve this issue. I believe there might be a specific approach or parameter setting that I am overlooking. I would greatly appreciate it if you could provide me with guidance or suggestions on addressing this issue.