Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions agilepy/api/AGAnalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ def getConfiguration(confFilePath, userName, sourceName, tmin, tmax, timetype, g
output:
outdir: {outputDir}
filenameprefix: analysis_product
logfilenameprefix: analysis_log
sourcename: {sourceName}
username: {userName}
verboselvl: {verboselvl}
Expand Down Expand Up @@ -955,7 +954,6 @@ def lightCurveMLE(self, sourceName, tmin = None, tmax = None, timetype = None, b
(_, last) = Utils._getFirstAndLastLineInFile(configBKP.getConf("input", "evtfile"))
idxTmax = float(Utils._extractTimes(last)[1])

# logFilenamePrefix = configBKP.getConf("output","logfilenameprefix")
# verboseLvl = configBKP.getConf("output","verboselvl")

self.logger.info( f"[LC] Number of processes: {processes}, Number of bins per process {len(binsForProcesses[0])}")
Expand Down Expand Up @@ -994,9 +992,8 @@ def lightCurveMLE(self, sourceName, tmin = None, tmax = None, timetype = None, b
"""
processes = []
for pID, pInputs in enumerate(binsForProcesses):
logFilenamePrefix += f"_thread_{pID}"
self.logger.info("generating process...(%d). Chunk size for process: %d"%(pID, len(pInputs)))
p = Process(target=self._computeLcBin, args=(pID, pInputs, configBKP, lcAnalysisDataDir, logsOutDir, logFilenamePrefix, verboseLvl))
p = Process(target=self._computeLcBin, args=(pID, pInputs, configBKP, lcAnalysisDataDir, logsOutDir, verboseLvl))
processes.append((pID,p,len(pInputs)))

for pID, p, binsNumber in processes:
Expand Down Expand Up @@ -1381,11 +1378,11 @@ def _updateFovMinMaxValues(fovbinnumber, fovradmin, fovradmax, stepi):

"""
The light curve data generation could be parallalezed..
def _computeLcBin(self, threadID, bins, configBKP, lcAnalysisDataDir, logsOutDir, logFilenamePrefix, verboseLvl):
def _computeLcBin(self, threadID, bins, configBKP, lcAnalysisDataDir, logsOutDir, verboseLvl):

logger = AgilepyLogger()

logger.initialize(logsOutDir, logFilenamePrefix, verboseLvl)
logger.initialize(logsOutDir, verboseLvl)

# outputs = []

Expand Down
1 change: 0 additions & 1 deletion agilepy/api/AGAnalysisWavelet.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ def getConfiguration(confFilePath, userName, outputDir, verboselvl, ctsmap, scal
output:
outdir: %s
filenameprefix: wavelet_product
logfilenameprefix: eng_log
username: %s
sourcename: wavelet
verboselvl: %d
Expand Down
1 change: 0 additions & 1 deletion agilepy/api/AGBayesianBlocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ def getConfiguration(confFilePath, outputDir, filePath,
output:
outdir: {outputDir}
filenameprefix: analysis_product
logfilenameprefix: analysis_log
sourcename: {sourceName}
username: {userName}
verboselvl: {verboselvl}
Expand Down
1 change: 0 additions & 1 deletion agilepy/api/AGEngAgileFermiOffAxisVisibilityComparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ def getConfiguration(confFilePath, userName, outputDir, verboselvl):
output:
outdir: %s
filenameprefix: eng_product
logfilenameprefix: eng_log
username: %s
sourcename: agilefermioffaxis
verboselvl: %d
Expand Down
1 change: 0 additions & 1 deletion agilepy/api/AGEngAgileOffaxisVisibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ def getConfiguration(confFilePath, userName, outputDir, verboselvl):
output:
outdir: %s
filenameprefix: eng_product
logfilenameprefix: eng_log
username: %s
sourcename: offaxis
verboselvl: %d
Expand Down
1 change: 0 additions & 1 deletion agilepy/api/AGRatemeters.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ def getConfiguration(confFilePath, outputDir, filePath, timetype, T0,
output:
outdir: {outputDir}
filenameprefix: ratemeters_product
logfilenameprefix: ratemeters_log
sourcename: {sourceName}
username: {userName}
verboselvl: {verboselvl}
Expand Down
2 changes: 1 addition & 1 deletion agilepy/config/AGAnalysisConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def checkOptionsType(self, **kwargs):


# String
elif optionName in ["evtfile", "logfile", "outdir", "filenameprefix", "logfilenameprefix", \
elif optionName in ["evtfile", "logfile", "outdir", "filenameprefix", \
"timetype", "timelist", "projtype", "proj", "modelfile", "minimizertype", \
"minimizeralg", "maplistgen", "irf"]:

Expand Down
2 changes: 1 addition & 1 deletion agilepy/config/AGBayesianBlocksConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def checkOptionsType(self, **kwargs):
elif optionName in ["ratecorrection", "tstart", "tstop", "p0", "gamma"]:
validType = (Number, 0)
# String
elif optionName in ["logfile", "filenameprefix", "logfilenameprefix", "sourcename", "username",
elif optionName in ["logfile", "filenameprefix", "sourcename", "username",
"file_path", "file_mode", "fitness",
]:
validType = (str, 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def checkOptionsType(self, **kwargs):
validType = ()

# String
if optionName in ["logfile", "outdir", "filenameprefix", "logfilenameprefix"]:
if optionName in ["logfile", "outdir", "filenameprefix"]:

validType = (str, 0)

Expand Down
2 changes: 1 addition & 1 deletion agilepy/config/AGEngAgileOffaxisVisibilityConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def checkOptionsType(self, **kwargs):
validType = ()

# String
if optionName in ["logfile", "outdir", "filenameprefix", "logfilenameprefix"]:
if optionName in ["logfile", "outdir", "filenameprefix"]:

validType = (str, 0)

Expand Down
2 changes: 1 addition & 1 deletion agilepy/config/AGRatemetersConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def checkOptionsType(self, **kwargs):
elif optionName in ["background_tmin", "background_tmax", "signal_tmin", "signal_tmax", "T0"]:
validType = (Number, 0)
# String
elif optionName in ["logfile", "filenameprefix", "logfilenameprefix", "sourcename", "username", "file_path", "timetype"]:
elif optionName in ["logfile", "filenameprefix", "sourcename", "username", "file_path", "timetype"]:
validType = (str, 0)
# Path
elif optionName in ["outdir"]:
Expand Down
5 changes: 1 addition & 4 deletions agilepy/config/AgilepyConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@ def loadBaseConfigurations(self, configurationFilePath):
if user_conf["output"]["filenameprefix"] is None:
errors.append("Please, set output/filenameprefix")

if user_conf["output"]["logfilenameprefix"] is None:
errors.append("Please, set output/logfilenameprefix")

if user_conf["output"]["sourcename"] is None:
errors.append("Please, set output/sourcename")

Expand Down Expand Up @@ -250,7 +247,7 @@ def getConf(self, key=None, subkey=None):

@staticmethod
def _notUpdatable(optionName):
if optionName in ["userestapi", "datapath", "logfilenameprefix", "verboselvl"]:
if optionName in ["userestapi", "datapath", "verboselvl"]:
return True
return False

Expand Down
56 changes: 27 additions & 29 deletions agilepy/scripts/download_test_dataset.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
#!/bin/bash
set -e
set -euo pipefail

# Set the directory path (change this to your target directory)
DIR="$AGILE/agilepy-test-data/"

# # Check if the directory exists
# if [ -d "$DIR" ]; then
# echo "Directory $DIR exists. Removing it..."
# rm -rf "$DIR"
# echo "Directory removed."
# else
# echo "Directory $DIR does not exist."
# fi
#
# # Create the directory
# mkdir -p "$DIR"
# echo "Directory $DIR created."
# Ensure directory exists
mkdir -p "$DIR"

# Move into the directory
cd "$DIR" || { echo "Failed to enter directory $DIR"; exit 1; }
Expand All @@ -24,22 +14,30 @@ echo "Now inside $DIR"
# Download test dataset
echo "Download test dataset..."

# These are downloaded in the base image
# wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1B31SCrHoOU0KnZoaZ7NTq6nY_PTD-ner' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=1B31SCrHoOU0KnZoaZ7NTq6nY_PTD-ner" -O test_dataset_6.0.tar.gz && rm -rf /tmp/cookies.txt && \
# tar -xzf test_dataset_6.0.tar.gz && \
# rm test_dataset_6.0.tar.gz

# wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1B3Tp-01-X7Cwh6lq11BUCiaHuctj0iDW' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=1B3Tp-01-X7Cwh6lq11BUCiaHuctj0iDW" -O test_dataset_agn.tar.gz && rm -rf /tmp/cookies.txt && \
# tar -xzf test_dataset_agn.tar.gz && \
# rm test_dataset_agn.tar.gz

wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1dRfBltxWvijKjxgU9lHTJRm--l8tbgGZ' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=1dRfBltxWvijKjxgU9lHTJRm--l8tbgGZ" -O bayesian_blocks.tar.gz && rm -rf /tmp/cookies.txt && \
tar -xzf bayesian_blocks.tar.gz && \
rm bayesian_blocks.tar.gz

wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1m7DhHHxiU3Q81biNvTGRAhFjP0j5IJfL' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=1m7DhHHxiU3Q81biNvTGRAhFjP0j5IJfL" -O ratemeters.tar.gz && rm -rf /tmp/cookies.txt && \
tar -xzf ratemeters.tar.gz && \
rm ratemeters.tar.gz
# Function to download and extract only if missing
download_and_extract() {
local id="$1"
local tar_name="$2"
local extract_dir="$3"

if [ -d "$extract_dir" ]; then
echo " $extract_dir already exists, skipping download."
else
echo " Downloading $tar_name ..."
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate "https://docs.google.com/uc?export=download&id=$id" -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1/p')&id=$id" -O "$tar_name" && \
rm -f /tmp/cookies.txt && \
tar -xzf "$tar_name" && \
rm "$tar_name"

echo " Extracted $extract_dir"
fi
}

# Datasets
download_and_extract "1B31SCrHoOU0KnZoaZ7NTq6nY_PTD-ner" "test_dataset_6.0.tar.gz" "test_dataset_6.0"
download_and_extract "1B3Tp-01-X7Cwh6lq11BUCiaHuctj0iDW" "test_dataset_agn.tar.gz" "test_dataset_agn"
download_and_extract "1dRfBltxWvijKjxgU9lHTJRm--l8tbgGZ" "bayesian_blocks.tar.gz" "bayesian_blocks"
download_and_extract "1m7DhHHxiU3Q81biNvTGRAhFjP0j5IJfL" "ratemeters.tar.gz" "ratemeters"

# End
echo "Download completed!"
1 change: 0 additions & 1 deletion agilepy/testing/unittesting/api/conf/agilepyconf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ input:
output:
outdir: $TEST_LOGS_DIR
filenameprefix: testcase
logfilenameprefix: logtestcase
sourcename: vela
username: unittesting
verboselvl: 0
Expand Down
1 change: 0 additions & 1 deletion agilepy/testing/unittesting/api/conf/agilepyconfREST.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ input:
output:
outdir: $TEST_LOGS_DIR
filenameprefix: testcase
logfilenameprefix: logtestcase
sourcename: vela
username: unittesting
verboselvl: 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
output:
outdir: $TEST_LOGS_DIR
filenameprefix: testcase
logfilenameprefix: logtestcase
sourcename: eng
username: user-test
verboselvl: 0
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
output:
outdir: $TEST_LOGS_DIR
filenameprefix: test_rm
logfilenameprefix: test_rm
sourcename: src-rm-test
username: user-test
verboselvl: 2
Expand Down
1 change: 0 additions & 1 deletion agilepy/testing/unittesting/api/conf/agilepyconfbkg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ input:
output:
outdir: $TEST_LOGS_DIR
filenameprefix: testcase
logfilenameprefix: logtestcase
sourcename: vela
username: unittesting
verboselvl: 2
Expand Down
1 change: 0 additions & 1 deletion agilepy/testing/unittesting/api/conf/conf_bb_agile_ph.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
output:
outdir: $TEST_LOGS_DIR
filenameprefix: testcase
logfilenameprefix: testcase
sourcename: source-test
username: user-test
verboselvl: 2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
output:
outdir: $TEST_LOGS_DIR
filenameprefix: test_rm
logfilenameprefix: test_rm
sourcename: src-rm-test
username: user-test
verboselvl: 2
Expand Down
1 change: 0 additions & 1 deletion agilepy/testing/unittesting/api/test_ag_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,6 @@ def test_fix_exponent(self, environ_test_logs_dir, config, testdatafiles):

ag.destroy()

#@pytest.mark.skip("Fails on MACOS")
@pytest.mark.testlogsdir("api/test_logs/test_aperture_photometry")
@pytest.mark.testconfig("api/conf/agilepyconf.yaml")
@pytest.mark.testdatafiles(["api/conf/sourcesconf_1.txt"])
Expand Down
1 change: 0 additions & 1 deletion agilepy/testing/unittesting/api/test_ag_bayesianblocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,6 @@ def test_get_configuration(self, environ_test_logs_dir, testdata):
assert ag_bb.getOption("username") == "my_name"
assert ag_bb.getOption("sourcename") == "bb-source"
assert ag_bb.getOption("filenameprefix") == "analysis_product"
assert ag_bb.getOption("logfilenameprefix") =="analysis_log"
assert ag_bb.getOption("verboselvl") == 0

assert ag_bb.getOption('file_path') == testdata
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
#You should have received a copy of the GNU General Public License
#along with this program. If not, see <https://www.gnu.org/licenses/>.

import os
import unittest
import pytest
from pathlib import Path
from agilepy.utils.Utils import Utils
Expand Down
1 change: 0 additions & 1 deletion agilepy/testing/unittesting/api/test_ag_ratemeters.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ def test_get_configuration(self, environ_test_logs_dir, testdata):
assert ag_rm.getOption("username") == "my_name"
assert ag_rm.getOption("sourcename") == "rm-source"
assert ag_rm.getOption("filenameprefix") == "ratemeters_product"
assert ag_rm.getOption("logfilenameprefix") =="ratemeters_log"
assert ag_rm.getOption("verboselvl") == 0

assert ag_rm.getOption('file_path') == testdata
Expand Down
1 change: 0 additions & 1 deletion agilepy/testing/unittesting/config/conf/agilepyconf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ input:
output:
outdir: $AGILE/agilepy-test-data/unittesting-output/config
filenameprefix: testcase
logfilenameprefix: testcase
sourcename: source-test
username: user-test
verboselvl: 1
Expand Down
1 change: 0 additions & 1 deletion agilepy/testing/unittesting/config/conf/conf1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ input:
output:
outdir: $AGILE/agilepy-test-data/unittesting-output/config
filenameprefix: testcase
logfilenameprefix: testcase
sourcename: source-test
username: user-test
verboselvl: 1
Expand Down
1 change: 0 additions & 1 deletion agilepy/testing/unittesting/config/conf/conf2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ input:
output:
outdir: $AGILE/agilepy-test-data/unittesting-output/config
filenameprefix: testcase
logfilenameprefix: testcase
sourcename: source-test
username: user-test
verboselvl: 1
Expand Down
1 change: 0 additions & 1 deletion agilepy/testing/unittesting/config/conf/conf3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ input:
output:
outdir: $AGILE/agilepy-test-data/unittesting-output/config
filenameprefix: testcase
logfilenameprefix: testcase
sourcename: source-test
username: user-test
verboselvl: 1
Expand Down
1 change: 0 additions & 1 deletion agilepy/testing/unittesting/config/conf/conf4.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ input:
output:
outdir: $AGILE/agilepy-test-data/unittesting-output/config
filenameprefix: testcase
logfilenameprefix: testcase
sourcename: source-test
username: user-test
verboselvl: 1
Expand Down
1 change: 0 additions & 1 deletion agilepy/testing/unittesting/config/conf/conf_bb.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
output:
outdir: $TEST_LOGS_DIR
filenameprefix: testcase
logfilenameprefix: testcase
sourcename: source-test
username: user-test
verboselvl: 2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
output:
outdir: $TEST_LOGS_DIR
filenameprefix: testcase
logfilenameprefix: testcase
sourcename: source-test
username: user-test
verboselvl: 2
Expand Down
1 change: 0 additions & 1 deletion agilepy/testing/unittesting/config/conf/conf_bb_null.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
output:
outdir: $TEST_LOGS_DIR
filenameprefix: testcase
logfilenameprefix: testcase
sourcename: source-test
username: user-test
verboselvl: 2
Expand Down
1 change: 0 additions & 1 deletion agilepy/testing/unittesting/config/conf/conf_notvalid.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ input:
output:
outdir: $AGILE/agilepy-test-data/unittesting-output/config
filenameprefix: testcase
logfilenameprefix: testcase
sourcename: source-test
username: user-test
verboselvl: 1
Expand Down
1 change: 0 additions & 1 deletion agilepy/testing/unittesting/config/conf/conf_rm_bad.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
output:
outdir: $TEST_LOGS_DIR
filenameprefix: testcase
logfilenameprefix: testcase
sourcename: source-test
username: user-test
verboselvl: 2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
output:
outdir: $TEST_LOGS_DIR
filenameprefix: testcase
logfilenameprefix: testcase
sourcename: source-test
username: user-test
verboselvl: 2
Expand Down
Loading