




"""simple docstring"""






from __future__ import annotations

import collections
import tempfile
import unittest

import numpy as np

from transformers.testing_utils import require_tf, require_vision, slow
from transformers.utils import is_tf_available, is_vision_available

from ...test_modeling_tf_common import floats_tensor, ids_tensor, random_attention_mask
from ..bert.test_modeling_tf_bert import TFBertModelTester
from ..clip.test_modeling_tf_clip import TFCLIPVisionModelTester
from ..deit.test_modeling_tf_deit import TFDeiTModelTester
from ..roberta.test_modeling_tf_roberta import TFRobertaModelTester
from ..vit.test_modeling_tf_vit import TFViTModelTester


if is_tf_available():
			from transformers import (
			    TFBertModel,
			    TFCLIPVisionModel,
			    TFDeiTModel,
			    TFRobertaModel,
			    TFVisionTextDualEncoderModel,
			    TFViTModel,
			    VisionTextDualEncoderConfig,
			)

if is_vision_available():
			from PIL import Image

			from transformers import VisionTextDualEncoderProcessor







def      _snake_case			(				lowercase__		):
				if isinstance(lowercase__							,    collections.abc.Iterable		):
								return x
				return (x, x)






@require_tf
class lowerCAmelCase__	:






			'''simple docstring'''



			def 					A_    (  self  ,      lowercase  ,      lowercase  ):
							pass
			def 					A_    (  self  ):
							pass
			def 					A_    (  self  ):
							pass
			def 					A_    (  self  ,      lowercase  ,      lowercase  ,      lowercase  ,      lowercase  ,      lowercase=None  ,      **lowercase  ):
							_lowerCamelCase     :			Tuple    =    VisionTextDualEncoderConfig.from_vision_text_configs(lowercase  ,      lowercase  )

							_lowerCamelCase     :			int    =    TFVisionTextDualEncoderModel(lowercase  )

							_lowerCamelCase     :			Optional[Any]    =    model(input_ids=lowercase  ,      pixel_values=lowercase  ,      attention_mask=lowercase  )

							self.assertEqual(output['text_embeds'].shape  ,      (input_ids.shape[0], config.projection_dim)  )
							self.assertEqual(output['image_embeds'].shape  ,      (pixel_values.shape[0], config.projection_dim)  )
			def 					A_    (  self  ,      lowercase  ,      lowercase  ,      lowercase  ,      lowercase  ,      lowercase=None  ,      **lowercase  ):
							_lowerCamelCase, _lowerCamelCase     :			Dict    =    self.get_vision_text_model(lowercase  ,      lowercase  )
							_lowerCamelCase     :			Optional[Any]    =    TFVisionTextDualEncoderModel(vision_model=lowercase  ,      text_model=lowercase  )

							_lowerCamelCase     :			List[str]    =    model(input_ids=lowercase  ,      pixel_values=lowercase  ,      attention_mask=lowercase  )

							self.assertEqual(output['text_embeds'].shape  ,      (input_ids.shape[0], model.config.projection_dim)  )
							self.assertEqual(output['image_embeds'].shape  ,      (pixel_values.shape[0], model.config.projection_dim)  )
			def 					A_    (  self  ,      lowercase  ,      lowercase  ,      lowercase  ,      lowercase  ,      lowercase=None  ,      **lowercase  ):
							_lowerCamelCase, _lowerCamelCase     :			List[Any]    =    self.get_vision_text_model(lowercase  ,      lowercase  )
							_lowerCamelCase     :			Tuple    =    {'vision_model': vision_model, 'text_model': text_model}
							_lowerCamelCase     :			Dict    =    TFVisionTextDualEncoderModel.from_vision_text_pretrained(**lowercase  )

							_lowerCamelCase     :			Dict    =    model(input_ids=lowercase  ,      pixel_values=lowercase  ,      attention_mask=lowercase  )

							self.assertEqual(output['text_embeds'].shape  ,      (input_ids.shape[0], model.config.projection_dim)  )
							self.assertEqual(output['image_embeds'].shape  ,      (pixel_values.shape[0], model.config.projection_dim)  )
			def 					A_    (  self  ,      lowercase  ,      lowercase  ,      lowercase  ,      lowercase  ,      lowercase=None  ,      **lowercase  ):
							_lowerCamelCase, _lowerCamelCase     :			int    =    self.get_vision_text_model(lowercase  ,      lowercase  )
							_lowerCamelCase     :			List[Any]    =    TFVisionTextDualEncoderModel(vision_model=lowercase  ,      text_model=lowercase  )

							_lowerCamelCase     :			Union[str, Any]    =    model(input_ids=lowercase  ,      pixel_values=lowercase  ,      attention_mask=lowercase  )
							_lowerCamelCase     :			Union[str, Any]    =    output[0].numpy()

							with tempfile.TemporaryDirectory() as tmpdirname:
											model.save_pretrained(lowercase  )
											_lowerCamelCase     :			List[Any]    =    TFVisionTextDualEncoderModel.from_pretrained(lowercase  )

											_lowerCamelCase     :			Tuple    =    model(input_ids=lowercase  ,      pixel_values=lowercase  ,      attention_mask=lowercase  )
											_lowerCamelCase     :			List[str]    =    after_output[0].numpy()
											_lowerCamelCase     :			Optional[int]    =    np.amax(np.abs(out_a - out_a  )  )
											self.assertLessEqual(lowercase  ,      1E-5  )
			def 					A_    (  self  ,      lowercase  ,      lowercase  ,      lowercase  ,      lowercase  ,      lowercase=None  ,      **lowercase  ):
							_lowerCamelCase, _lowerCamelCase     :			List[Any]    =    self.get_vision_text_model(lowercase  ,      lowercase  )
							_lowerCamelCase     :			List[str]    =    TFVisionTextDualEncoderModel(vision_model=lowercase  ,      text_model=lowercase  )

							_lowerCamelCase     :			Tuple    =    model(
							    input_ids=lowercase  ,      pixel_values=lowercase  ,      attention_mask=lowercase  ,      output_attentions=lowercase  )

							_lowerCamelCase     :			List[Any]    =    output.vision_model_output.attentions
							self.assertEqual(len(lowercase  )  ,      vision_config.num_hidden_layers  )

							# in ViT, the seq_len equals the number of patches + 1 (we add 1 for the [CLS] token)
							_lowerCamelCase     :			Any    =    to_atuple(vision_model.config.image_size  )
							_lowerCamelCase     :			List[Any]    =    to_atuple(vision_model.config.patch_size  )
							_lowerCamelCase     :			Optional[int]    =    (image_size[1] // patch_size[1]) * (image_size[0] // patch_size[0])
							_lowerCamelCase     :			Tuple    =    num_patches + 1
							self.assertEqual(vision_attentions[0].shape[-3:]  ,      (vision_config.num_attention_heads, seq_len, seq_len)  )

							_lowerCamelCase     :			Union[str, Any]    =    output.text_model_output.attentions
							self.assertEqual(len(lowercase  )  ,      text_config.num_hidden_layers  )

							self.assertEqual(
							    text_attentions[0].shape[-3:]  ,      (text_config.num_attention_heads, input_ids.shape[-1], input_ids.shape[-1])  ,      )
			def 					A_    (  self  ,      lowercase  ,      lowercase  ,      lowercase  ):
							_lowerCamelCase     :			Tuple    =    np.abs((a - b)  ).max()
							self.assertLessEqual(lowercase  ,      lowercase  ,      F'''Difference between torch and flax is {diff} (>= {tol}).'''  )
			def 					A_    (  self  ):
							_lowerCamelCase     :			Any    =    self.prepare_config_and_inputs()
							self.check_vision_text_dual_encoder_model(**lowercase  )
			def 					A_    (  self  ):
							_lowerCamelCase     :			Optional[Any]    =    self.prepare_config_and_inputs()
							self.check_model_from_pretrained_configs(**lowercase  )
			def 					A_    (  self  ):
							_lowerCamelCase     :			Optional[int]    =    self.prepare_config_and_inputs()
							self.check_vision_text_dual_encoder_from_pretrained(**lowercase  )
			def 					A_    (  self  ):
							_lowerCamelCase     :			List[Any]    =    self.prepare_config_and_inputs()
							self.check_save_load(**lowercase  )
			def 					A_    (  self  ):
							_lowerCamelCase     :			Any    =    self.prepare_config_and_inputs()
							self.check_vision_text_output_attention(**lowercase  )






			@slow
			def 					A_    (  self  ):
							_lowerCamelCase, _lowerCamelCase     :			int    =    self.get_pretrained_model_and_inputs()

							_lowerCamelCase     :			str    =    model_a(**lowercase  )
							_lowerCamelCase     :			List[Any]    =    outputs[0].numpy()

							with tempfile.TemporaryDirectory() as tmp_dirname:
											model_a.save_pretrained(lowercase  )
											_lowerCamelCase     :			List[Any]    =    TFVisionTextDualEncoderModel.from_pretrained(lowercase  )

											_lowerCamelCase     :			Union[str, Any]    =    model_a(**lowercase  )
											_lowerCamelCase     :			Optional[Any]    =    after_outputs[0].numpy()
											_lowerCamelCase     :			Tuple    =    np.amax(np.abs(out_a - out_a  )  )
											self.assertLessEqual(lowercase  ,      1E-5  )






@require_tf
class lowerCAmelCase__	(     lowercase,	unittest.TestCase						):






			'''simple docstring'''



			def 					A_    (  self  ):
							_lowerCamelCase     :			Optional[Any]    =    TFVisionTextDualEncoderModel.from_vision_text_pretrained(
							    'hf-internal-testing/tiny-random-vit'  ,      'hf-internal-testing/tiny-random-bert'  )
							_lowerCamelCase     :			Tuple    =    13
							_lowerCamelCase     :			Tuple    =    floats_tensor(
							    [
							        batch_size,
							        model.vision_model.config.num_channels,
							        model.vision_model.config.image_size,
							        model.vision_model.config.image_size,
							    ]  )
							_lowerCamelCase     :			Dict    =    ids_tensor([batch_size, 4]  ,      model.text_model.config.vocab_size  )
							_lowerCamelCase     :			int    =    random_attention_mask([batch_size, 4]  )
							_lowerCamelCase     :			Any    =    {'pixel_values': pixel_values, 'input_ids': input_ids, 'attention_mask': attention_mask}

							return model, inputs
			def 					A_    (  self  ,      lowercase  ,      lowercase  ):
							_lowerCamelCase     :			int    =    TFViTModel(lowercase  ,      name='vision_model'  )
							_lowerCamelCase     :			Union[str, Any]    =    TFBertModel(lowercase  ,      name='text_model'  )
							return vision_model, text_model






			def 					A_    (  self  ):
							_lowerCamelCase     :			Optional[int]    =    TFViTModelTester(self  )
							_lowerCamelCase     :			str    =    TFBertModelTester(self  )
							_lowerCamelCase     :			int    =    vit_model_tester.prepare_config_and_inputs()
							_lowerCamelCase     :			str    =    bert_model_tester.prepare_config_and_inputs()

							_lowerCamelCase, _lowerCamelCase, _lowerCamelCase     :			Dict    =    vision_config_and_inputs

							(
							    (
							    _lowerCamelCase
							), (
							    _lowerCamelCase
							), (
							    _lowerCamelCase
							), (
							    _lowerCamelCase
							), (
							    _lowerCamelCase
							), (
							    _lowerCamelCase
							), (
							    _lowerCamelCase
							), 
							)     :			Union[str, Any]    =    text_config_and_inputs

							return {
							    "text_config": text_config,
							    "vision_config": vision_config,
							    "pixel_values": pixel_values,
							    "attention_mask": input_mask,
							    "input_ids": input_ids,
							    "text_token_type_ids": token_type_ids,
							    "text_sequence_labels": sequence_labels,
							    "text_token_labels": token_labels,
							    "text_choice_labels": choice_labels,
							}






@require_tf
class lowerCAmelCase__	(     lowercase,	unittest.TestCase						):






			'''simple docstring'''



			def 					A_    (  self  ):
							# DeiT repo doesn't have TF weights, but we don't actually use the weights at all so let's
							# just reinitialize it.
							_lowerCamelCase     :			int    =    TFVisionTextDualEncoderModel.from_vision_text_pretrained(
							    'Rocketknight1/tiny-random-deit-tf'  ,      'hf-internal-testing/tiny-random-roberta'  )
							_lowerCamelCase     :			Tuple    =    13
							_lowerCamelCase     :			Tuple    =    floats_tensor(
							    [
							        batch_size,
							        model.vision_model.config.num_channels,
							        model.vision_model.config.image_size,
							        model.vision_model.config.image_size,
							    ]  )
							_lowerCamelCase     :			Tuple    =    ids_tensor([batch_size, 4]  ,      model.text_model.config.vocab_size  )
							_lowerCamelCase     :			str    =    random_attention_mask([batch_size, 4]  )
							_lowerCamelCase     :			Optional[Any]    =    {'pixel_values': pixel_values, 'input_ids': input_ids, 'attention_mask': attention_mask}

							return model, inputs
			def 					A_    (  self  ,      lowercase  ,      lowercase  ,      lowercase  ,      lowercase  ,      lowercase=None  ,      **lowercase  ):
							_lowerCamelCase, _lowerCamelCase     :			Union[str, Any]    =    self.get_vision_text_model(lowercase  ,      lowercase  )
							_lowerCamelCase     :			Dict    =    TFVisionTextDualEncoderModel(vision_model=lowercase  ,      text_model=lowercase  )

							_lowerCamelCase     :			List[Any]    =    model(
							    input_ids=lowercase  ,      pixel_values=lowercase  ,      attention_mask=lowercase  ,      output_attentions=lowercase  )

							_lowerCamelCase     :			Union[str, Any]    =    output.vision_model_output.attentions
							self.assertEqual(len(lowercase  )  ,      vision_config.num_hidden_layers  )

							# in DEiT, the seq_len equals the number of patches + 2 (we add 2 for the [CLS] and distillation tokens)
							_lowerCamelCase     :			Any    =    to_atuple(vision_model.config.image_size  )
							_lowerCamelCase     :			Union[str, Any]    =    to_atuple(vision_model.config.patch_size  )
							_lowerCamelCase     :			Union[str, Any]    =    (image_size[1] // patch_size[1]) * (image_size[0] // patch_size[0])
							_lowerCamelCase     :			Optional[int]    =    num_patches + 2
							self.assertEqual(vision_attentions[0].shape[-3:]  ,      (vision_config.num_attention_heads, seq_len, seq_len)  )

							_lowerCamelCase     :			List[Any]    =    output.text_model_output.attentions
							self.assertEqual(len(lowercase  )  ,      text_config.num_hidden_layers  )

							self.assertEqual(
							    text_attentions[0].shape[-3:]  ,      (text_config.num_attention_heads, input_ids.shape[-1], input_ids.shape[-1])  ,      )
			def 					A_    (  self  ,      lowercase  ,      lowercase  ):
							_lowerCamelCase     :			List[Any]    =    TFDeiTModel(lowercase  ,      name='vision_model'  )
							_lowerCamelCase     :			List[str]    =    TFRobertaModel(lowercase  ,      name='text_model'  )
							return vision_model, text_model






			def 					A_    (  self  ):
							_lowerCamelCase     :			Any    =    TFDeiTModelTester(self  )
							_lowerCamelCase     :			Union[str, Any]    =    TFRobertaModelTester(self  )
							_lowerCamelCase     :			Optional[int]    =    vit_model_tester.prepare_config_and_inputs()
							_lowerCamelCase     :			int    =    bert_model_tester.prepare_config_and_inputs()

							_lowerCamelCase, _lowerCamelCase, _lowerCamelCase     :			Dict    =    vision_config_and_inputs

							(
							    (
							    _lowerCamelCase
							), (
							    _lowerCamelCase
							), (
							    _lowerCamelCase
							), (
							    _lowerCamelCase
							), (
							    _lowerCamelCase
							), (
							    _lowerCamelCase
							), (
							    _lowerCamelCase
							), 
							)     :			Dict    =    text_config_and_inputs

							return {
							    "text_config": text_config,
							    "vision_config": vision_config,
							    "pixel_values": pixel_values,
							    "attention_mask": input_mask,
							    "input_ids": input_ids,
							    "text_token_type_ids": token_type_ids,
							    "text_sequence_labels": sequence_labels,
							    "text_token_labels": token_labels,
							    "text_choice_labels": choice_labels,
							}






@require_tf
class lowerCAmelCase__	(     lowercase,	unittest.TestCase						):






			'''simple docstring'''



			def 					A_    (  self  ):
							_lowerCamelCase     :			Dict    =    TFVisionTextDualEncoderModel.from_vision_text_pretrained(
							    'Rocketknight1/tiny-random-clip-tf'  ,      'hf-internal-testing/tiny-random-bert'  )
							_lowerCamelCase     :			Any    =    13
							_lowerCamelCase     :			List[Any]    =    floats_tensor(
							    [
							        batch_size,
							        model.vision_model.config.num_channels,
							        model.vision_model.config.image_size,
							        model.vision_model.config.image_size,
							    ]  )
							_lowerCamelCase     :			Any    =    ids_tensor([batch_size, 4]  ,      model.text_model.config.vocab_size  )
							_lowerCamelCase     :			List[Any]    =    random_attention_mask([batch_size, 4]  )
							_lowerCamelCase     :			List[Any]    =    {'pixel_values': pixel_values, 'input_ids': input_ids, 'attention_mask': attention_mask}

							return model, inputs
			def 					A_    (  self  ,      lowercase  ,      lowercase  ):
							_lowerCamelCase     :			Optional[int]    =    TFCLIPVisionModel(lowercase  ,      name='vision_model'  )
							_lowerCamelCase     :			List[str]    =    TFBertModel(lowercase  ,      name='text_model'  )
							return vision_model, text_model






			def 					A_    (  self  ):
							_lowerCamelCase     :			Union[str, Any]    =    TFCLIPVisionModelTester(self  )
							_lowerCamelCase     :			Optional[Any]    =    TFBertModelTester(self  )
							_lowerCamelCase     :			str    =    clip_model_tester.prepare_config_and_inputs()
							_lowerCamelCase     :			Optional[int]    =    bert_model_tester.prepare_config_and_inputs()

							_lowerCamelCase, _lowerCamelCase     :			List[Any]    =    vision_config_and_inputs

							(
							    (
							    _lowerCamelCase
							), (
							    _lowerCamelCase
							), (
							    _lowerCamelCase
							), (
							    _lowerCamelCase
							), (
							    _lowerCamelCase
							), (
							    _lowerCamelCase
							), (
							    _lowerCamelCase
							), 
							)     :			List[str]    =    text_config_and_inputs

							return {
							    "text_config": text_config,
							    "vision_config": vision_config,
							    "pixel_values": pixel_values,
							    "attention_mask": input_mask,
							    "input_ids": input_ids,
							    "text_token_type_ids": token_type_ids,
							    "text_sequence_labels": sequence_labels,
							    "text_token_labels": token_labels,
							    "text_choice_labels": choice_labels,
							}






@require_vision
@require_tf
class lowerCAmelCase__	(     unittest.TestCase						):






			'''simple docstring'''



			@slow
			def 					A_    (  self  ):
							_lowerCamelCase     :			List[str]    =    TFVisionTextDualEncoderModel.from_pretrained(
							    'clip-italian/clip-italian'  ,      logit_scale_init_value=1.0  ,      from_pt=lowercase  )
							_lowerCamelCase     :			str    =    VisionTextDualEncoderProcessor.from_pretrained('clip-italian/clip-italian'  )

							_lowerCamelCase     :			Optional[Any]    =    Image.open('./tests/fixtures/tests_samples/COCO/000000039769.png'  )
							_lowerCamelCase     :			List[Any]    =    processor(
							    text=['una foto di un gatto', 'una foto di un cane']  ,      images=lowercase  ,      padding=lowercase  ,      return_tensors='np'  )

							_lowerCamelCase     :			List[Any]    =    model(**lowercase  )

							# verify the logits
							self.assertEqual(outputs.logits_per_image.shape  ,      (inputs.pixel_values.shape[0], inputs.input_ids.shape[0])  )
							self.assertEqual(
							    outputs.logits_per_text.shape  ,      (inputs.input_ids.shape[0], inputs.pixel_values.shape[0])  ,      )

							_lowerCamelCase     :			int    =    np.array([[1.2_28_47_27, 0.3_10_41_22]]  )

							self.assertTrue(np.allclose(outputs.logits_per_image.numpy()  ,      lowercase  ,      atol=1E-3  )  )





"""simple docstring"""






# Imports
import numpy as np






class lowerCAmelCase__	:






			'''simple docstring'''



			def __init__(  self  ,      lowercase=None  ,      lowercase=None  ,      lowercase=None  ,      lowercase=None  ,      lowercase=None  ):
							self.set_matricies(red=lowercase  ,      green=lowercase  ,      blue=lowercase  ,      red_edge=lowercase  ,      nir=lowercase  )
			def 					A_    (  self  ,      lowercase=None  ,      lowercase=None  ,      lowercase=None  ,      lowercase=None  ,      lowercase=None  ):
							if red is not None:
											_lowerCamelCase     :			Optional[int]    =    red
							if green is not None:
											_lowerCamelCase     :			Optional[Any]    =    green
							if blue is not None:
											_lowerCamelCase     :			Tuple    =    blue
							if red_edge is not None:
											_lowerCamelCase     :			Optional[Any]    =    red_edge
							if nir is not None:
											_lowerCamelCase     :			Union[str, Any]    =    nir
							return True
			def 					A_    (  self  ,      lowercase=""  ,      lowercase=None  ,      lowercase=None  ,      lowercase=None  ,      lowercase=None  ,      lowercase=None  ):
							self.set_matricies(red=lowercase  ,      green=lowercase  ,      blue=lowercase  ,      red_edge=lowercase  ,      nir=lowercase  )
							_lowerCamelCase     :			str    =    {
							    'ARVI2': self.arvaa,
							    'CCCI': self.ccci,
							    'CVI': self.cvi,
							    'GLI': self.gli,
							    'NDVI': self.ndvi,
							    'BNDVI': self.bndvi,
							    'redEdgeNDVI': self.red_edge_ndvi,
							    'GNDVI': self.gndvi,
							    'GBNDVI': self.gbndvi,
							    'GRNDVI': self.grndvi,
							    'RBNDVI': self.rbndvi,
							    'PNDVI': self.pndvi,
							    'ATSAVI': self.atsavi,
							    'BWDRVI': self.bwdrvi,
							    'CIgreen': self.ci_green,
							    'CIrededge': self.ci_rededge,
							    'CI': self.ci,
							    'CTVI': self.ctvi,
							    'GDVI': self.gdvi,
							    'EVI': self.evi,
							    'GEMI': self.gemi,
							    'GOSAVI': self.gosavi,
							    'GSAVI': self.gsavi,
							    'Hue': self.hue,
							    'IVI': self.ivi,
							    'IPVI': self.ipvi,
							    'I': self.i,
							    'RVI': self.rvi,
							    'MRVI': self.mrvi,
							    'MSAVI': self.m_savi,
							    'NormG': self.norm_g,
							    'NormNIR': self.norm_nir,
							    'NormR': self.norm_r,
							    'NGRDI': self.ngrdi,
							    'RI': self.ri,
							    'S': self.s,
							    'IF': self._if,
							    'DVI': self.dvi,
							    'TVI': self.tvi,
							    'NDRE': self.ndre,
							}

							try:
											return funcs[index]()
							except KeyError:
											print('Index not in the list!'  )
											return False
			def 					A_    (  self  ):
							return -0.18 + (1.17 * ((self.nir - self.red) / (self.nir + self.red)))
			def 					A_    (  self  ):
							return ((self.nir - self.redEdge) / (self.nir + self.redEdge)) / (
							    (self.nir - self.red) / (self.nir + self.red)
							)
			def 					A_    (  self  ):
							return self.nir * (self.red / (self.green**2))
			def 					A_    (  self  ):
							return (2 * self.green - self.red - self.blue) / (
							    2 * self.green + self.red + self.blue
							)
			def 					A_    (  self  ):
							return (self.nir - self.red) / (self.nir + self.red)
			def 					A_    (  self  ):
							return (self.nir - self.blue) / (self.nir + self.blue)
			def 					A_    (  self  ):
							return (self.redEdge - self.red) / (self.redEdge + self.red)
			def 					A_    (  self  ):
							return (self.nir - self.green) / (self.nir + self.green)
			def 					A_    (  self  ):
							return (self.nir - (self.green + self.blue)) / (
							    self.nir + (self.green + self.blue)
							)
			def 					A_    (  self  ):
							return (self.nir - (self.green + self.red)) / (
							    self.nir + (self.green + self.red)
							)
			def 					A_    (  self  ):
							return (self.nir - (self.blue + self.red)) / (self.nir + (self.blue + self.red))
			def 					A_    (  self  ):
							return (self.nir - (self.green + self.red + self.blue)) / (
							    self.nir + (self.green + self.red + self.blue)
							)
			def 					A_    (  self  ,      lowercase=0.08  ,      lowercase=1.22  ,      lowercase=0.03  ):
							return a * (
							    (self.nir - a * self.red - b)
							    / (a * self.nir + self.red - a * b + x * (1 + a**2))
							)
			def 					A_    (  self  ):
							return (0.1 * self.nir - self.blue) / (0.1 * self.nir + self.blue)
			def 					A_    (  self  ):
							return (self.nir / self.green) - 1
			def 					A_    (  self  ):
							return (self.nir / self.redEdge) - 1
			def 					A_    (  self  ):
							return (self.red - self.blue) / self.red
			def 					A_    (  self  ):
							_lowerCamelCase     :			Any    =    self.ndvi()
							return ((ndvi + 0.5) / (abs(ndvi + 0.5  ))) * (abs(ndvi + 0.5  ) ** (1 / 2))
			def 					A_    (  self  ):
							return self.nir - self.green
			def 					A_    (  self  ):
							return 2.5 * (
							    (self.nir - self.red) / (self.nir + 6 * self.red - 7.5 * self.blue + 1)
							)
			def 					A_    (  self  ):
							_lowerCamelCase     :			Any    =    (2 * (self.nir**2 - self.red**2) + 1.5 * self.nir + 0.5 * self.red) / (
							    self.nir + self.red + 0.5
							)
							return n * (1 - 0.25 * n) - (self.red - 0.1_25) / (1 - self.red)
			def 					A_    (  self  ,      lowercase=0.16  ):
							return (self.nir - self.green) / (self.nir + self.green + y)
			def 					A_    (  self  ,      lowercase=0.5  ):
							return ((self.nir - self.green) / (self.nir + self.green + n)) * (1 + n)
			def 					A_    (  self  ):
							return np.arctan(
							    ((2 * self.red - self.green - self.blue) / 30.5) * (self.green - self.blue)  )
			def 					A_    (  self  ,      lowercase=None  ,      lowercase=None  ):
							return (self.nir - b) / (a * self.red)
			def 					A_    (  self  ):
							return (self.nir / ((self.nir + self.red) / 2)) * (self.ndvi() + 1)
			def 					A_    (  self  ):
							return (self.red + self.green + self.blue) / 30.5
			def 					A_    (  self  ):
							return self.nir / self.red
			def 					A_    (  self  ):
							return (self.rvi() - 1) / (self.rvi() + 1)
			def 					A_    (  self  ):
							return (
							    (2 * self.nir + 1)
							    - ((2 * self.nir + 1) ** 2 - 8 * (self.nir - self.red)) ** (1 / 2)
							) / 2
			def 					A_    (  self  ):
							return self.green / (self.nir + self.red + self.green)
			def 					A_    (  self  ):
							return self.nir / (self.nir + self.red + self.green)
			def 					A_    (  self  ):
							return self.red / (self.nir + self.red + self.green)
			def 					A_    (  self  ):
							return (self.green - self.red) / (self.green + self.red)
			def 					A_    (  self  ):
							return (self.red - self.green) / (self.red + self.green)
			def 					A_    (  self  ):
							_lowerCamelCase     :			Union[str, Any]    =    np.max([np.max(self.red  ), np.max(self.green  ), np.max(self.blue  )]  )
							_lowerCamelCase     :			Dict    =    np.min([np.min(self.red  ), np.min(self.green  ), np.min(self.blue  )]  )
							return (max_value - min_value) / max_value
			def 					A_    (  self  ):
							return (2 * self.red - self.green - self.blue) / (self.green - self.blue)
			def 					A_    (  self  ):
							return self.nir / self.red
			def 					A_    (  self  ):
							return (self.ndvi() + 0.5) ** (1 / 2)






			def 					A_    (  self  ):
							return (self.nir - self.redEdge) / (self.nir + self.redEdge)